content stringlengths 85 101k | title stringlengths 0 150 | question stringlengths 15 48k | answers list | answers_scores list | non_answers list | non_answers_scores list | tags list | name stringlengths 35 137 |
|---|---|---|---|---|---|---|---|---|
Q:
Uncompress a zlib-compressed string in Java
I have a Java module that is receiving a compressed string from a remote Python script. The Python script compresses the string using zlib.compress(). I simply want to uncompress it in Java and display it to the user.
The man page for Java's built-in zip.Deflater object ... | Uncompress a zlib-compressed string in Java | I have a Java module that is receiving a compressed string from a remote Python script. The Python script compresses the string using zlib.compress(). I simply want to uncompress it in Java and display it to the user.
The man page for Java's built-in zip.Deflater object describes pretty explicitly how to uncompress som... | [
"The confusion has arisen because some bright spark started describing the zlib protocol as \"deflate\". It might help you to read the RFCs mentioned in these Java docs.\nAlso this SO topic is quite relevant.\nI suggest that you do\nprint repr(zlib.compress(\"The quick brown dog etc etc\")\nin Python (A) and compar... | [
2,
0
] | [] | [] | [
"java",
"python",
"zlib"
] | stackoverflow_0005532591_java_python_zlib.txt |
Q:
Google App Engine bulkloader issue when using yaml autogenerated configuration and entities with numeric ID
My application uses Django non-rel. I don't have access to model.
I have my bulkloader.yaml file autogenerated by appcfg.py create_bulkloader_config.
Problem is entities numeric ID's are being imported as... | Google App Engine bulkloader issue when using yaml autogenerated configuration and entities with numeric ID | My application uses Django non-rel. I don't have access to model.
I have my bulkloader.yaml file autogenerated by appcfg.py create_bulkloader_config.
Problem is entities numeric ID's are being imported as string key names. So if I export entity with int ID of, for example, '62', it gets imported as entity with strin... | [
"You've got the export_transform 'key_id_or_name_as_string', but you don't have a corresponding import transform. Try this:\nproperty_map:\n - property: __key__\n external_name: key\n export_transform: transform.key_id_or_name_as_string\n import_transform: transform.create_foreign_key('Kind', key_is_id=True)\... | [
6,
2
] | [] | [] | [
"bulkloader",
"django",
"django_nonrel",
"google_app_engine",
"python"
] | stackoverflow_0003129286_bulkloader_django_django_nonrel_google_app_engine_python.txt |
Q:
How do I log a user in using repoze.who?
I have a working repoze.who/what setup (on a Pylons app). I now want to automatically log new users in after signup, without them having to use the login form. I've browsed the repoze.who docs and source code and, maybe I'm just missing it, but I can't find out how to set t... | How do I log a user in using repoze.who? | I have a working repoze.who/what setup (on a Pylons app). I now want to automatically log new users in after signup, without them having to use the login form. I've browsed the repoze.who docs and source code and, maybe I'm just missing it, but I can't find out how to set the logged-in user from code, without a new pos... | [
"I have been with similar issue all the morning and this is what I've found:\nYou must know that right now there's two versions of repoze.who (1 and 2):\nIn v 1.x:\nrememberer = request.environ['repoze.who.plugins']['cookie']\nidentity = {'repoze.who.userid': user.username}\nresponse.headerlist = response.headerlis... | [
3
] | [] | [] | [
"authentication",
"pylons",
"python",
"repoze.who"
] | stackoverflow_0004191276_authentication_pylons_python_repoze.who.txt |
Q:
Facebook authentication - are there different approaches?
I'm in process of building an app for Facebook using Python and Django. I'm investigating different solutions for integration with Facebook authentication API.
So far I've found the two viable solutions:
django-social-auth
python-sdk
I've already tried th... | Facebook authentication - are there different approaches? | I'm in process of building an app for Facebook using Python and Django. I'm investigating different solutions for integration with Facebook authentication API.
So far I've found the two viable solutions:
django-social-auth
python-sdk
I've already tried the first one and it seems to work nicely. I've just read about t... | [
"When you use a backend implementation (python, PHP, Perl, etc), you generally have to use URL redirects (Graph API) to interact with Facebook and the user. Personally, I don't think this is a good user experience. \nUsing the javascript SDK, you can do everything inline. Which means the user never has to leave you... | [
3
] | [] | [] | [
"django",
"facebook",
"facebook_oauth",
"oauth",
"python"
] | stackoverflow_0005532961_django_facebook_facebook_oauth_oauth_python.txt |
Q:
question about filtering a dictionary using a list in python
with the following dictionary and array:
a = { 'a':[1,2,3,4,5], 'b':[1,2,3], 'c':[1,2,3,4,5] }
b = ['a','c']
I would like to filter a into a new dictionary to only have the key-values in the array b so i end up with:
c = {'a': [1, 2, 3, 4, 5], 'c': [1... | question about filtering a dictionary using a list in python | with the following dictionary and array:
a = { 'a':[1,2,3,4,5], 'b':[1,2,3], 'c':[1,2,3,4,5] }
b = ['a','c']
I would like to filter a into a new dictionary to only have the key-values in the array b so i end up with:
c = {'a': [1, 2, 3, 4, 5], 'c': [1, 2, 3, 4, 5]}
So.. the obvious way to do this for me was the fol... | [
"The built-in map() can always be substituted by a list comprehension. The call\nmap(callable, iterable)\n\nis equivalent to\n[callable(x) for x in iterable]\n\nIf callable is a lambda-expression, the latter form is faster and more readable, which is why it is prefered in this case.\nIf you don't really need the l... | [
4,
2,
0
] | [] | [] | [
"python"
] | stackoverflow_0005533154_python.txt |
Q:
GAE Task Queue: Task not running/outputting
I've started using the task queue to schedule a time-intensive task to run in the background. The task I want to run is in the URL '/test', and the URL I am using to schedule the task is '/bgtest'. Here is the handler for '/bgtest':
class RunTestAsBackgroundProcess(BaseH... | GAE Task Queue: Task not running/outputting | I've started using the task queue to schedule a time-intensive task to run in the background. The task I want to run is in the URL '/test', and the URL I am using to schedule the task is '/bgtest'. Here is the handler for '/bgtest':
class RunTestAsBackgroundProcess(BaseHandler):
def get_secure(self):
taskqueue.add(... | [
"It looks like your /test script is fetching from what I can only presume is a session, and then redirecting based on that. That's obviously not going to work in a Task Queue task - there is no user, and hence no session.\n"
] | [
1
] | [] | [] | [
"google_app_engine",
"python",
"scheduled_tasks"
] | stackoverflow_0005529337_google_app_engine_python_scheduled_tasks.txt |
Q:
Why isn't my pathtracing code working?
I've been hacking together a pathtracer in pure Python, just for fun, and since my previous shading-thing wasn't too pretty (Lambert's cosine law), I'm trying to implement recursive pathtracing.
My engine gives an abortive output:
My pathtracing function is defined recursive... | Why isn't my pathtracing code working? | I've been hacking together a pathtracer in pure Python, just for fun, and since my previous shading-thing wasn't too pretty (Lambert's cosine law), I'm trying to implement recursive pathtracing.
My engine gives an abortive output:
My pathtracing function is defined recursively, like this:
def TracePath2(ray, scene, bo... | [
"My first question is should if test > result: be if test < result:? You're looking for the closest hit, not the furthest.\nSecond, why do you add direction*0.00001 to the hit point here n = Ray(ray.position(result) + direction * 0.00001, direction)? That would put the start of your new ray inside the spheres. I be... | [
4
] | [] | [] | [
"python",
"raytracing"
] | stackoverflow_0005533048_python_raytracing.txt |
Q:
Metaclasses configure classes. But can we configure metaclasses?
I discovered that the existence and use of metaclasses can save you from a lot code-writing by providing an elegant handle on the process of class creation. I use this in my application, where several interacting servers are instantiated. To elaborat... | Metaclasses configure classes. But can we configure metaclasses? | I discovered that the existence and use of metaclasses can save you from a lot code-writing by providing an elegant handle on the process of class creation. I use this in my application, where several interacting servers are instantiated. To elaborate:
Each device instantiates a server class specific to its operation, ... | [
"\n1 - How can one supply metaclasses with configuration info?\n\nThere are a couple of ways to do that - since your metaclasses live in their own module\n(and yes, the module is executed once at import time, regardless of how many times it is imported in the same application), a nice way to configure them would b... | [
3
] | [] | [] | [
"configuration",
"finite_automata",
"metaclass",
"python"
] | stackoverflow_0005531483_configuration_finite_automata_metaclass_python.txt |
Q:
Is there grammar or lexer and parser for Python (or subset), written in PLY?
Is there grammar or lexer and parser for Python (or subset), written in PLY?
A:
I've found it myself:
python4ply
A:
Perhaps not exactly what you were looking for, but Jeremy Seik at the University of Colorado Boulder runs ECEN 4543 - ... | Is there grammar or lexer and parser for Python (or subset), written in PLY? | Is there grammar or lexer and parser for Python (or subset), written in PLY?
| [
"I've found it myself:\npython4ply\n",
"Perhaps not exactly what you were looking for, but Jeremy Seik at the University of Colorado Boulder runs ECEN 4543 - Introduction to Compilers that uses a combination of the python AST module and ply to build up larger and larger subsets of python, and uses the results to ... | [
2,
2
] | [] | [] | [
"parsing",
"ply",
"python"
] | stackoverflow_0005527439_parsing_ply_python.txt |
Q:
Many to many relation in GAE. Failing query
I've been modeling many to many relationships in gae using the classic ListProperty of db.Key instances.
class Foo(db.Model):
name = db.StringProperty()
_bars = db.ListProperty(db.Key)
@property
def bars(self):
return Bar.gql("WHERE __key__ in :1... | Many to many relation in GAE. Failing query | I've been modeling many to many relationships in gae using the classic ListProperty of db.Key instances.
class Foo(db.Model):
name = db.StringProperty()
_bars = db.ListProperty(db.Key)
@property
def bars(self):
return Bar.gql("WHERE __key__ in :1", self._bars)
class Bar(db.Model):
name = d... | [
"This certainly look anomalous. Can you run AppStats, and see what underlying queries are being executed?\nHowever, what you're doing is not the most efficient way. When you run a query like SELECT * FROM Foo WHERE bar in :1, the SDK breaks this up into one equality query for each item in the list, and executes the... | [
1
] | [] | [] | [
"google_app_engine",
"python"
] | stackoverflow_0005529042_google_app_engine_python.txt |
Q:
How do I add multiple strings over several lines in Python?
I'm lost in Python world:
message = struct.pack('B', 4) +
minissdpdStringEncode(st) +
minissdpdStringEncode(usn) +
minissdpdStringEncode(server) +
minissdpdStringEncode(location)
It doesn't run. Do I really need to put this all on one lin... | How do I add multiple strings over several lines in Python? | I'm lost in Python world:
message = struct.pack('B', 4) +
minissdpdStringEncode(st) +
minissdpdStringEncode(usn) +
minissdpdStringEncode(server) +
minissdpdStringEncode(location)
It doesn't run. Do I really need to put this all on one line or something?
That would be messy in my opinion.
| [
"You have two choices:\nmessage = struct.pack('B', 4) + \\\n minissdpdStringEncode(st)\n\nor\nmessage = (struct.pack('B', 4) +\n minissdpdStringEncode(st))\n\nI usually find the second form with parentheses easier to read.\n",
"You can continue a line by ending it with a backslash \\:\nmessage = struct.pack... | [
8,
2,
2
] | [] | [] | [
"python"
] | stackoverflow_0005533401_python.txt |
Q:
Issue with installing mod_wsgi on a CentOS 5
i have to install the mod_wsgi library on a CentOS 64bits and python3.2, but now is giving me this mistake when i try to run the 'make' command, anyone could help me, thanks in advance!
/usr/sbin/apxs -c -I/usr/local/include/python3.2m -DNDEBUG mod_wsgi.c -L/usr/local... | Issue with installing mod_wsgi on a CentOS 5 | i have to install the mod_wsgi library on a CentOS 64bits and python3.2, but now is giving me this mistake when i try to run the 'make' command, anyone could help me, thanks in advance!
/usr/sbin/apxs -c -I/usr/local/include/python3.2m -DNDEBUG mod_wsgi.c -L/usr/local/lib -L/usr/local/lib/python3.2/config -lpython3.... | [
"Your Python 3.2 installation appears to be broken, missing bits or build wrongly. Even if you fix it, that will not help unless you are using mod_wsgi from subversion repository trunk as Python 3.2 cannot be used with the official tarball versions. Based on error messages it even seems you may even be trying to us... | [
3
] | [] | [] | [
"apache",
"mod_wsgi",
"python",
"python_3.x"
] | stackoverflow_0005531669_apache_mod_wsgi_python_python_3.x.txt |
Q:
python string formatting
I need some help with the Python's new string formatter. Basically, I want the outer curly braces to not escape the string replacement field.
This works:
foo = 'bar'
print '{%s}' % foo
But, this doesn't:
foo = 'bar'
print('{{0}}'.format(foo))
Desired output:
'{bar}'
A:
It looks like yo... | python string formatting | I need some help with the Python's new string formatter. Basically, I want the outer curly braces to not escape the string replacement field.
This works:
foo = 'bar'
print '{%s}' % foo
But, this doesn't:
foo = 'bar'
print('{{0}}'.format(foo))
Desired output:
'{bar}'
| [
"It looks like you want:\n>>> foo = 'bar'\n>>> print('{{{0}}}'.format(foo))\n'{bar}'\n\nThe outer pair of doubled {{ and }} are copied literally to the output, leaving {0} to be interpreted as a substitution.\n",
"{{ is an escaped {, but you still need {0} as the placeholder, thus:\nprint('{{{0}}}'.format('bar'))... | [
7,
4
] | [] | [] | [
"format",
"python",
"string"
] | stackoverflow_0005533700_format_python_string.txt |
Q:
python sys.argv limitations?
Suppose I'd like to run a python script like this: python my_script.py MY_INPUT.
In this case, MY_INPUT will be transmitted to sys.argv[1].
Is there a limit to the number of characters MY_INPUT can contain?
Is there a limit to the type of characters MY_INPUT can contain?
Any other li... | python sys.argv limitations? | Suppose I'd like to run a python script like this: python my_script.py MY_INPUT.
In this case, MY_INPUT will be transmitted to sys.argv[1].
Is there a limit to the number of characters MY_INPUT can contain?
Is there a limit to the type of characters MY_INPUT can contain?
Any other limitations with regards to MY_INPUT... | [
"The size of argv is limited by the operating system, and it varies wildly from OS to OS. Quoting from the Linux execve(2) manpage:\nLimits on size of arguments and environment\n Most Unix implementations impose some limit on the total size\n of the command-line argument (argv) and environment (envp)\n string... | [
15,
3
] | [] | [] | [
"python"
] | stackoverflow_0005533704_python.txt |
Q:
How to put certain parts of a string into a list
So i have the code
op = urlopen('http://example.com/download_music/' + mus + '-1.html')
ops = op.read()
af = file('mus.txt', 'w')
asv = file('mu.txt', 'w')
af.write(str(ops))
if 'charset="utf-8">var playlist' in ops:
print 'yes'
cal = ops.split('charset="ut... | How to put certain parts of a string into a list | So i have the code
op = urlopen('http://example.com/download_music/' + mus + '-1.html')
ops = op.read()
af = file('mus.txt', 'w')
asv = file('mu.txt', 'w')
af.write(str(ops))
if 'charset="utf-8">var playlist' in ops:
print 'yes'
cal = ops.split('charset="utf-8">var playlist',1)
del cal[0]
asv.write(str... | [
"A quick hack would be something like\n# x is your string\nimport re\nparsed = re.findall('author : \"([^\"]+)\",title : \"([^\"]+)\",type : \"([^\"]+)\",file : \"([^\"]+)\",id : \"([^\"]+)', x)\nprint parsed\n\n"
] | [
0
] | [] | [] | [
"python"
] | stackoverflow_0005533008_python.txt |
Q:
shutil moving files keeping the same directory structure
I want to move a lot of files. the path to these files is stored in a list. I want to keep the whole directory structure but want to move them to a different folder.
So for example the files are
D:\test\test1\test1.txt
D:\test\test1\test2.txt
I want to move... | shutil moving files keeping the same directory structure | I want to move a lot of files. the path to these files is stored in a list. I want to keep the whole directory structure but want to move them to a different folder.
So for example the files are
D:\test\test1\test1.txt
D:\test\test1\test2.txt
I want to move them to C:\ from D:\ and keep the directory structure. How sh... | [
"I think you want something like this:\nimport sys\nimport os\nimport shutil\n\n# terminology:\n# path = full path to a file, i.e. directory + file name\n# directory = directory, possibly starting with a drive\n# file name = the last component of the path\n\nsourcedrive = 'D:'\ndestdrive = 'C:'\n\nlog_list_file = o... | [
5,
2
] | [] | [] | [
"python"
] | stackoverflow_0005533517_python.txt |
Q:
how to grep by date time range?
I have a log file looks like:
2011-03-21 00:01 xxxx
2011-03-22 04:05 xxxx
....
2011-03-25 10:12 xxxx
....
2011-04-04 12:23 xxxx
I want to have a script which requires 2 arguments as the date range, for example:
grep-date-range.sh 2011-03-25 2011-04-02
It will find all logs in [201... | how to grep by date time range? | I have a log file looks like:
2011-03-21 00:01 xxxx
2011-03-22 04:05 xxxx
....
2011-03-25 10:12 xxxx
....
2011-04-04 12:23 xxxx
I want to have a script which requires 2 arguments as the date range, for example:
grep-date-range.sh 2011-03-25 2011-04-02
It will find all logs in [2011-03-25, 2011-04-02]. I know for a sp... | [
"his is a case where it may be better to write a short Python script. The high level date manipulations capabilities in thelanguage can be handy.\nThe script bellow is very simple - with a bit more work it could take care of localtime differences, Daylight saving time, and so on.\n#! /usr/bin/python\nimport sys\n... | [
3,
3,
1,
0
] | [] | [] | [
"awk",
"bash",
"grep",
"python",
"sed"
] | stackoverflow_0005533671_awk_bash_grep_python_sed.txt |
Q:
In Python, is there a clean way to return the value of a function if it's not None?
I find myself writing a lot of code that resembles the following:
ans = call_function()
if ans:
return ans
...
Is there a clean way to make this a 1 or 2 liner? An "example" of such a paradigm might be
if x as call_function()... | In Python, is there a clean way to return the value of a function if it's not None? | I find myself writing a lot of code that resembles the following:
ans = call_function()
if ans:
return ans
...
Is there a clean way to make this a 1 or 2 liner? An "example" of such a paradigm might be
if x as call_function():
return x
| [
"It seems that as long as ans is not None, you can just return it, based on your implied usage. \nif ans is not None:\n return ans\n\n",
"I'm not sure what you're doing after your if, but perhaps you're doing the following:\nans = call_function()\nif ans:\n return ans\nelse:\n return default\n\nIn which ... | [
1,
1,
0,
0
] | [] | [] | [
"idioms",
"paradigms",
"python"
] | stackoverflow_0005527718_idioms_paradigms_python.txt |
Q:
How can i ensure my client's gravatar on my portal is at most a rating of PG
Currently, my default gravatar src does not specify any rating level for display. As such, any user who uses PG and above would not be able to view their gravatar image on the portal - i suppose the default is G. How can i modify the url... | How can i ensure my client's gravatar on my portal is at most a rating of PG | Currently, my default gravatar src does not specify any rating level for display. As such, any user who uses PG and above would not be able to view their gravatar image on the portal - i suppose the default is G. How can i modify the url such that i could ensure client's gravatar would be able to display with at the m... | [
"Check out Image Requests:\n\nGravatar allows users to self-rate\n their images so that they can indicate\n if an image is appropriate for a\n certain audience. By default, only 'G'\n rated images are displayed unless you\n indicate that you would like to see\n higher ratings. Using the r= or\n rating= param... | [
2
] | [] | [] | [
"django",
"gravatar",
"python"
] | stackoverflow_0005534078_django_gravatar_python.txt |
Q:
Removing unneccessary inner tags
We are converting DOCX to HTML through some external converter tool.
The generated HTML for tables contains something like this:
<td><div><span><b>Patienten</b></span></div></td>
The <div> and <span> tags inside TD are completely superfluous here.
The expected result is
<td><b>Pa... | Removing unneccessary inner tags | We are converting DOCX to HTML through some external converter tool.
The generated HTML for tables contains something like this:
<td><div><span><b>Patienten</b></span></div></td>
The <div> and <span> tags inside TD are completely superfluous here.
The expected result is
<td><b>Patienten</b></td>
Is there some chance... | [
"Well, the <div> and <span> tags have a structural meaning, that cannot be automatically guessed as \"superfluous\".\nYour problem looks very similar to AST (Abstract Syntax Tree) optimization done in compilers. You could try to define some rules and build a SoupOptimizer to take a tree (your document) and produce ... | [
1,
1,
0,
0,
0,
0
] | [] | [] | [
"beautifulsoup",
"html",
"python"
] | stackoverflow_0005473966_beautifulsoup_html_python.txt |
Q:
from a import b in python 2.4
Need help with import in python 2.4
The problem statement is:
src\
__init__.py
main.py
dirFoo\
__init__.py
Foo.py
dirBar\
__init__.py
Bar.py
I need to access main.py in Foo.py
The version of python is 2.4.3. Its much easier in python > 2.5. But I am a hard time in 2.4
A:
A simple a... | from a import b in python 2.4 | Need help with import in python 2.4
The problem statement is:
src\
__init__.py
main.py
dirFoo\
__init__.py
Foo.py
dirBar\
__init__.py
Bar.py
I need to access main.py in Foo.py
The version of python is 2.4.3. Its much easier in python > 2.5. But I am a hard time in 2.4
| [
"A simple absolute import (i.e. import src.main) should work regardless of Python version.\nHowever, there are a few things that would help clarify your question.\n\nIs the source layout flat (as currently shown in the question) or nested (as shown below):\nsrc\\\n __init__.py\n main.py\n dirFoo\\\n ... | [
0
] | [] | [] | [
"python",
"python_import"
] | stackoverflow_0005534461_python_python_import.txt |
Q:
Facebook login for Django and url redirection?
I have implemented a Django app having a user login/registration page. I wanted to make facebook user id's also possible for logging into my app. In doing so, i followed this link http://developers.facebook.com/docs/guides/web/#login . With the help of that link i can... | Facebook login for Django and url redirection? | I have implemented a Django app having a user login/registration page. I wanted to make facebook user id's also possible for logging into my app. In doing so, i followed this link http://developers.facebook.com/docs/guides/web/#login . With the help of that link i can now login using the Facebook id also. Clicking on t... | [
"That code just looks like FB's HTML. You'd need to give us a better idea of your Django Auth structure if you wanted more help.\nThere are quite a few more steps ahead of you. I would look into Django-SocialAuth for an easily integrated experience if I were you.\nEdit: \nAs a follow up to the inclusion of your S... | [
3
] | [] | [] | [
"django",
"facebook",
"javascript",
"python"
] | stackoverflow_0005534712_django_facebook_javascript_python.txt |
Q:
return django view to template tag
I want have template tag...
There is some view and template ( named X ), when i call this view, return some html
for example
<h1>hi</h1>
In index of test application, i want when call template tag in template of this view, template tag return html of named X
for example
<h2>t... | return django view to template tag | I want have template tag...
There is some view and template ( named X ), when i call this view, return some html
for example
<h1>hi</h1>
In index of test application, i want when call template tag in template of this view, template tag return html of named X
for example
<h2>test</h2>
{% template_Tag_return_x_view %... | [
"If you want to reuse your view's logic in several places it maybe it easier to turn the view into an inclusion tag.\nIt's more flexible than a simple include as you can specify parameters that influence the output.\n",
"I suggest you look at the include template tag.\n"
] | [
2,
1
] | [] | [] | [
"django",
"django_templates",
"python"
] | stackoverflow_0005535248_django_django_templates_python.txt |
Q:
Python based publish subscribe middleware
Is there a scalable, python based publish subscribe middleware available? I tried RabbitMQ, but it does not scale well over 32-64 nodes.
I need a middleware that could run over >1000 nodes
Thanks
A:
It depends on what do you mean about 'scalability'. RabbitMQ is designed... | Python based publish subscribe middleware | Is there a scalable, python based publish subscribe middleware available? I tried RabbitMQ, but it does not scale well over 32-64 nodes.
I need a middleware that could run over >1000 nodes
Thanks
| [
"It depends on what do you mean about 'scalability'. RabbitMQ is designed for high stability with scalability.\nThere is also ZeroMQ, designed for very high performance (but less features).\nYou can see the performance tests of ZeroMQ.\n"
] | [
3
] | [] | [] | [
"middleware",
"publish_subscribe",
"python"
] | stackoverflow_0005535685_middleware_publish_subscribe_python.txt |
Q:
Django - Automatically Assign Cleaned Data to Database Fields
The usual way I do form handling is like this:
contact = Contact(
name=form.cleaned_data['name'],
email=form.cleaned_data['email'],
message=form.cleaned_data['message'],
newsletter=form.cle... | Django - Automatically Assign Cleaned Data to Database Fields | The usual way I do form handling is like this:
contact = Contact(
name=form.cleaned_data['name'],
email=form.cleaned_data['email'],
message=form.cleaned_data['message'],
newsletter=form.cleaned_data['newsletter']
)
but for long forms, this obv... | [
"Django offers you a Modelform class that was desgined for exactly this task.\n"
] | [
1
] | [] | [] | [
"django",
"python"
] | stackoverflow_0005535443_django_python.txt |
Q:
Dereference variables at class initialization
This is my code for initializing the class dictionary:
class Directory:
def __init__(self, **kwds):
self.__dict__.update(kwds)
obj = Directory(name=dict())
In the above case, the key is name, and can be accessed using:
obj.__dict__.['name'] or obj.name
Q1... | Dereference variables at class initialization | This is my code for initializing the class dictionary:
class Directory:
def __init__(self, **kwds):
self.__dict__.update(kwds)
obj = Directory(name=dict())
In the above case, the key is name, and can be accessed using:
obj.__dict__.['name'] or obj.name
Q1.How can I initialize the class dictionary with key... | [
"Am I right in thinking that you want to be able to call the constructor with keyword arguments, but use the value of the variable as the argument name, rather than the variable name itself?\nIt can't be done with that precise syntax, but here are a couple of other syntaxes you could use:\nname = 'bin'\nobj = Direc... | [
5
] | [] | [] | [
"dictionary",
"python"
] | stackoverflow_0005535586_dictionary_python.txt |
Q:
Distributing python code with virtualenv?
I want to distribute some python code, with a few external dependencies, to machines with only core python installed (and users that unfamiliar with easy_install etc.).
I was wondering if perhaps virtualenv can be used for this purpose? I should be able to write some bash... | Distributing python code with virtualenv? | I want to distribute some python code, with a few external dependencies, to machines with only core python installed (and users that unfamiliar with easy_install etc.).
I was wondering if perhaps virtualenv can be used for this purpose? I should be able to write some bash scripts that trigger the virtualenv (with the ... | [
"You can use a tool like PyInstaller for this purpose. Your application will appear as a single executable on all platforms, and include dependencies. The user doesn't even need Python installed!\nSee as an example my logview package, which has dependencies on PyQt4 and ZeroMQ and includes distributions for Linux, ... | [
6,
6,
5
] | [] | [] | [
"distribute",
"installation",
"python",
"virtualenv"
] | stackoverflow_0005535979_distribute_installation_python_virtualenv.txt |
Q:
Numpy.putmask with images
I have an image converted to a ndarray with RGBA values. Suppose it's 50 x 50 x 4.
I want to replace all the pixels with values array([255, 255, 255, 255]) for array([0, 0, 0, 0]). So:
from numpy import *
from PIL import Image
def test(mask):
mask = array(mask)
find = arra... | Numpy.putmask with images | I have an image converted to a ndarray with RGBA values. Suppose it's 50 x 50 x 4.
I want to replace all the pixels with values array([255, 255, 255, 255]) for array([0, 0, 0, 0]). So:
from numpy import *
from PIL import Image
def test(mask):
mask = array(mask)
find = array([255, 255, 255, 255])
... | [
"A more concise way to do this is\nimg = Image.open('test.png')\na = numpy.array(img)\na[(a == 255).all(axis=-1)] = 0\nimg2 = Image.fromarray(a, mode='RGBA')\n\nMore generally, if the items of find and repl are not all the same, you can also do\nfind = [1, 2, 3, 4]\nrepl = [5, 6, 7, 8]\na[(a == find).all(axis=-1)] ... | [
4,
2,
2
] | [] | [] | [
"arrays",
"image",
"image_processing",
"numpy",
"python"
] | stackoverflow_0005533996_arrays_image_image_processing_numpy_python.txt |
Q:
OpenGL & HTML Canvas
How can I use OpenGL for canvas programming?Recently I am working on canvas programming.Previous I used OpenGL in Java/C++/Python. But now want to use it with JavaScript or such kind library e.g. jQuery. But how? Pls help me.
A:
Look into WebGL. I don't think it's a w3c standard yet, but the... | OpenGL & HTML Canvas | How can I use OpenGL for canvas programming?Recently I am working on canvas programming.Previous I used OpenGL in Java/C++/Python. But now want to use it with JavaScript or such kind library e.g. jQuery. But how? Pls help me.
| [
"Look into WebGL. I don't think it's a w3c standard yet, but the way things are going it'll probably become one.\nhttp://www.khronos.org/webgl/\n"
] | [
3
] | [] | [] | [
"cakephp",
"canvas",
"jquery",
"opengl",
"python"
] | stackoverflow_0005537061_cakephp_canvas_jquery_opengl_python.txt |
Q:
how to install pythonwebkit and pywebkitgtk in ubuntu?
i am a new to use ubuntu.
i want to install pythonwebkit and pywebkitgtk in ubuntu,but i have tryed a long time. even thongth i can install,but,when i excute this code,
#!/usr/bin/env python
import pygtk
pygtk.require("2.0")
import gi
from gi.repository impor... | how to install pythonwebkit and pywebkitgtk in ubuntu? | i am a new to use ubuntu.
i want to install pythonwebkit and pywebkitgtk in ubuntu,but i have tryed a long time. even thongth i can install,but,when i excute this code,
#!/usr/bin/env python
import pygtk
pygtk.require("2.0")
import gi
from gi.repository import WebKit as webkit, Gtk as gtk
dir(gtk)
print dir(gtk.Windo... | [
"Run your import directives in the interpreter.\nIf that doesn't throw any exceptions (as I gather from where you say the error arises), then the problem is most likely not with installing the libraries, and has nothing to do with Ubuntu.\nPython is not saying 'hey, this is not installed correctly', it's saying 'he... | [
0
] | [] | [] | [
"dom",
"python",
"webkit"
] | stackoverflow_0005536016_dom_python_webkit.txt |
Q:
I want to learn to automate the creation of legal documents (in Word) using a template I possess
I have a template for a legal document that I need to create copies of. While most of the legal text will remain the same for each copy, what changes is small counter-party related details (like name, age, address, con... | I want to learn to automate the creation of legal documents (in Word) using a template I possess | I have a template for a legal document that I need to create copies of. While most of the legal text will remain the same for each copy, what changes is small counter-party related details (like name, age, address, contract amount etc).
I am hoping there is a way by which I can store the changing counter-party details ... | [
"Since you are using word, try Mail Merge.\nIt allows you to use a database and insert the data into the document for each row in the database.\nhttp://office.microsoft.com/en-us/word-help/word-mail-merge-a-walk-through-the-process-HA001034920.aspx\nThat should do the trick.\n",
"If you are using docx (as opposed... | [
2,
0
] | [] | [] | [
"automation",
"ms_word",
"python"
] | stackoverflow_0005533715_automation_ms_word_python.txt |
Q:
python data mining
I am not too much onto data mining but I require some ideas on clustering. Let me first describe my problem.
I have a around 100 data sheets which contain user reviews. I am trying to find for instances words that describe quality. One can say it is amazing quality another person can say great q... | python data mining | I am not too much onto data mining but I require some ideas on clustering. Let me first describe my problem.
I have a around 100 data sheets which contain user reviews. I am trying to find for instances words that describe quality. One can say it is amazing quality another person can say great quality now I have to clu... | [
"There is http://www.nltk.org/ for language processing. With this library you are able to split text into sentences, calculate term frequences, find synonyms and more.\nCarrot^2 is a nice opensource project for clustering text snippets, unfortunately it's written in Java. The idea behind its clustering is terms and... | [
4,
4,
1
] | [] | [] | [
"data_mining",
"nlp",
"python"
] | stackoverflow_0005535623_data_mining_nlp_python.txt |
Q:
why hitting refresh button is not calling the view method of the page's url?
I have django supported web application. when i hit refresh button on a page the view method corresponding to the page's url is not being called. But it gets called when i re-enter the url in th address bar. can any one suggest the reason... | why hitting refresh button is not calling the view method of the page's url? | I have django supported web application. when i hit refresh button on a page the view method corresponding to the page's url is not being called. But it gets called when i re-enter the url in th address bar. can any one suggest the reason and the solution?
| [
"check caching.\n\nfirst check cache meta tags on the client\nthen check web server cache\n\nNote: \"GET\" requets some times cached on the server or client automatically.\n",
"finally found the ans: just add the new tab command to your html page itself\n"
] | [
0,
0
] | [] | [] | [
"django",
"django_views",
"python"
] | stackoverflow_0005471312_django_django_views_python.txt |
Q:
Python Function Tracing
To make the process of recursion more visible, this example is given:
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n - 1) + fib(n - 2)
def trace(f):
f.indent = 0
def g(x):
print('| ' * f.indent + '|--', f.__name... | Python Function Tracing | To make the process of recursion more visible, this example is given:
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n - 1) + fib(n - 2)
def trace(f):
f.indent = 0
def g(x):
print('| ' * f.indent + '|--', f.__name__, x)
f.indent += 1
... | [
"Whew. All right, here we go!\nFirst, you have a function, any function. In your case, that's fib(). Now, in python, functions are also objects, and they can be created in runtime, so we can actually do this:\ndef give_me_a_function():\n def f(x):\n return x\n\n return f\n\n(Warning: horrible repetitio... | [
7,
4,
1
] | [] | [] | [
"python",
"recursion"
] | stackoverflow_0005537425_python_recursion.txt |
Q:
Adding page-layout-aware horizontal lines to a ReportLab table layout
I'm building a PDF using ReportLab, with a Table containing most of the content.
To help distinguish rows visually, I'd like to put a horizontal line after every row, as long as it is not the last row on a page.
To put a horizontal line after ev... | Adding page-layout-aware horizontal lines to a ReportLab table layout | I'm building a PDF using ReportLab, with a Table containing most of the content.
To help distinguish rows visually, I'd like to put a horizontal line after every row, as long as it is not the last row on a page.
To put a horizontal line after every row, I could just use a TableStyle:
style = TableStyle([
("LINEBEL... | [
"But it should work: that's the beauty of -1: it will be the last row/column no matter what. The only real trick is how to eliminate the line after the last row. To do it, just change the coordinates where your \"LINEBELOW\" ends. That is, your tuple should look like this:\n(\"LINEBELOW\", (0, 0), (-1, -2), 1,... | [
2
] | [] | [] | [
"python",
"reportlab"
] | stackoverflow_0005530800_python_reportlab.txt |
Q:
A Python Problem: A function that calculates a value from two given dictionaries
This is a tutorial problem that I have come across and after learning Python for about a month now, this really challenges me since I haven't encountered this type of problem before.
I want to calculate the total cost of a given 'id' ... | A Python Problem: A function that calculates a value from two given dictionaries | This is a tutorial problem that I have come across and after learning Python for about a month now, this really challenges me since I haven't encountered this type of problem before.
I want to calculate the total cost of a given 'id' from the 2 dictionaries. Below shows my dictionaries:
a = {'HIN3': ('Plastic Wrap', 50... | [
"First, an easy-to-follow function:\ndef getCost(id):\n total_cost = 0\n ingredients = b[id][1] # Second element of tuple is ingredient list\n\n for ingredient, amount in ingredients:\n total_cost += a[ingredient][1] * amount\n\n return total_cost\n\nNow, a cute one-liner:\ndef getCost(id):\n ... | [
2
] | [] | [] | [
"dictionary",
"list",
"python",
"sum"
] | stackoverflow_0005537903_dictionary_list_python_sum.txt |
Q:
Using YAML in GAE environment
GAE uses PyYAML to deal with YAML files. I see that library in GAE Python SDK in lib folder inside GAE SDK folder. I copied it into my app project and imported its modules. It's all working fine on my local PC. Is that possible to use PyYAML from GAE environment without having to have... | Using YAML in GAE environment | GAE uses PyYAML to deal with YAML files. I see that library in GAE Python SDK in lib folder inside GAE SDK folder. I copied it into my app project and imported its modules. It's all working fine on my local PC. Is that possible to use PyYAML from GAE environment without having to have a copy of it in my application? If... | [
"According to the website, PyYAML 3.05 is included:\n\nThe App Engine Python SDK uses YAML as the format for its configuration files. The environment provides the YAML parsing libraries for Python, PyYAML 3.05.\n\nI expect you can just include it the normal way:\n>>> import yaml\n\n"
] | [
3
] | [] | [] | [
"google_app_engine",
"python",
"yaml"
] | stackoverflow_0005537718_google_app_engine_python_yaml.txt |
Q:
Pythonic error handling of complex functions
I'd like to know if there is a Pythonic way for handling errors in long-running functions that can have errors in part that do not affect the ability of the function to continue.
As an example, consider a function that given a list of URLs, it recursively retrieves the ... | Pythonic error handling of complex functions | I'd like to know if there is a Pythonic way for handling errors in long-running functions that can have errors in part that do not affect the ability of the function to continue.
As an example, consider a function that given a list of URLs, it recursively retrieves the resource and all linked resources under the path o... | [
"I don't think there's a particularly clear \"Pythonic/non-Pythonic\" distinction at the level you're talking about here.\nOne of the big reasons there's no \"one-size-fits-all\" solution in this domain, is that the exact semantics you want are going to be problem specific.\n\nFor one situation, abort-on-first-fail... | [
6,
0
] | [] | [] | [
"error_handling",
"python"
] | stackoverflow_0005535421_error_handling_python.txt |
Q:
Pip installing into an older Python version
I am trying to install mysql-python using:
pip install mysql-python
the package is being installed below, although I already have Python 2.6 on the system.
/Library/Python/2.5/site-packages
How can I get pip to install in:
/Library/Python/2.6/site-packages
I tried us... | Pip installing into an older Python version | I am trying to install mysql-python using:
pip install mysql-python
the package is being installed below, although I already have Python 2.6 on the system.
/Library/Python/2.5/site-packages
How can I get pip to install in:
/Library/Python/2.6/site-packages
I tried using:
pip install --install-option="--prefix=/Libr... | [
"You should have pip-2.6. If you don't have pip version 2.6 :\nYou have to install setuptools for Python 2.6 (example : setuptools-0.6c11-py2.6.egg). Then, you have easy_install-2.6. You can do :\neasy_install-2.6 pip\n\nFinally, you have pip version 2.6. To install mysql-python :\npip-2.6 install mysql-python\n\n"... | [
27
] | [] | [] | [
"pip",
"python"
] | stackoverflow_0005538329_pip_python.txt |
Q:
Compress GAE Blob images using Python Base64?
I'm pulling a JSON request of 20 random thumbnails to an iPhone application. At the moment I'm simply including the image thumb URLs in the JSON array (see below), then the iPhone goes out to get each image. This is really slow.
Original JSON Request:
{
"item_list"... | Compress GAE Blob images using Python Base64? | I'm pulling a JSON request of 20 random thumbnails to an iPhone application. At the moment I'm simply including the image thumb URLs in the JSON array (see below), then the iPhone goes out to get each image. This is really slow.
Original JSON Request:
{
"item_list": [
{
"item_name": "Item One",
"us... | [
"Yes, encoding the images directly using base64 seems like a reasonable approach, given they're only thumbnails. This is similar to using data: URLs in a webpage for the same reason.\nDoing it should be as simple as calling the same Images API transforms you do in your regular code to generate the thumbnail, then s... | [
1,
0
] | [] | [] | [
"base64",
"blob",
"google_app_engine",
"image",
"python"
] | stackoverflow_0005535092_base64_blob_google_app_engine_image_python.txt |
Q:
Perl vs PHP to web scraping
Say we have project that requires web scraping. (parsing strings (< 40) and scraping web pages (geting meta datas and such)
I am aware of that perl has great and suited cpan modules for this job, so i can take that way and don't bother myself that much. But i don't have a clue about spe... | Perl vs PHP to web scraping | Say we have project that requires web scraping. (parsing strings (< 40) and scraping web pages (geting meta datas and such)
I am aware of that perl has great and suited cpan modules for this job, so i can take that way and don't bother myself that much. But i don't have a clue about speed and memory related stuff.
So, ... | [
"Use Perl or Python. Both have tons of libraries for web scraping.\nIn Python you could use BeautifulSoup to parse even the crappy kind of HTML lots of pages like to use.\n",
"I once successfully used Perl with WWW-Mechanize in such a context. Hopefully you don't need to evaluate .js.\n",
"I would go with perl.... | [
4,
3,
1
] | [] | [] | [
"performance",
"perl",
"php",
"python",
"web_scraping"
] | stackoverflow_0005538386_performance_perl_php_python_web_scraping.txt |
Q:
In Python, without using the /proc filesystem, how do I tell if a given PID is running?
Say I have a PID, like 555. I want to see if that pid is running or has completed. I can check /proc/ but I don't have access to that in my production environment. What's the best way to do this, short of something hackish like... | In Python, without using the /proc filesystem, how do I tell if a given PID is running? | Say I have a PID, like 555. I want to see if that pid is running or has completed. I can check /proc/ but I don't have access to that in my production environment. What's the best way to do this, short of something hackish like opening a pipe to "ps"?
| [
"Use the os.kill() function with a signal number of 0. If the process pid exists, then the call will be successful, else it will raise an OSError exception:\ntry:\n os.kill(pid, 0)\n print(\"process exists\")\nexcept OSError:\n print(\"process does not exist\")\n\nThe documentation for kill(2) on my system... | [
11,
2
] | [] | [] | [
"linux",
"operating_system",
"pid",
"python",
"unix"
] | stackoverflow_0004551187_linux_operating_system_pid_python_unix.txt |
Q:
DBus Finch/Pidgin without X11
I want to do some Python scripting on my server where I can communicate with finch (A console interface of pidgin, with the interface looking like links2) through the DBus Python library to send messages or check for buddy online status.
This works if you do it in X. Run finch in an X... | DBus Finch/Pidgin without X11 | I want to do some Python scripting on my server where I can communicate with finch (A console interface of pidgin, with the interface looking like links2) through the DBus Python library to send messages or check for buddy online status.
This works if you do it in X. Run finch in an X terminal and run the Python script... | [
"Install screen\n\ndbus-launch screen\nfinch\nctrl+a c\npython myscript\n\n",
"I think finch needs some display. To launch it on the server try to use xvfb-run: http://en.wikipedia.org/wiki/Xvfb\n"
] | [
6,
0
] | [] | [] | [
"dbus",
"finch",
"pidgin",
"python",
"x11"
] | stackoverflow_0005530542_dbus_finch_pidgin_python_x11.txt |
Q:
Determining redirected URL in Python
I made a little parser using HTMLparser and I would like to know where a link is redirected. I don't know how to explain this, so please look this example:
On my page I have a link on the source: http://www.myweb.com?out=147, which redirects to http://www.mylink.com. I can pars... | Determining redirected URL in Python | I made a little parser using HTMLparser and I would like to know where a link is redirected. I don't know how to explain this, so please look this example:
On my page I have a link on the source: http://www.myweb.com?out=147, which redirects to http://www.mylink.com. I can parse http://www.myweb.com?out=147 without any... | [
"You can use urllib2 (urllib.request in Python 3) and its HTTPRedirectHandler in order to find out where a URL will redirect you. Here's a function that does that:\nimport urllib2\n\ndef get_redirected_url(url):\n opener = urllib2.build_opener(urllib2.HTTPRedirectHandler)\n request = opener.open(url)\n ret... | [
11,
3
] | [] | [] | [
"parsing",
"python",
"redirect"
] | stackoverflow_0005538280_parsing_python_redirect.txt |
Q:
I left Python learning because of Python 2 vs 3
I wanted To learn how to program for the first time.
Because i`m mainly practice on IT and Security, I choose to start with Python.
But, As is started to learn Python 3, I came to realize that Non of the modules I wanted to use were ported to Python 3, and even Djan... | I left Python learning because of Python 2 vs 3 | I wanted To learn how to program for the first time.
Because i`m mainly practice on IT and Security, I choose to start with Python.
But, As is started to learn Python 3, I came to realize that Non of the modules I wanted to use were ported to Python 3, and even Django (one of the main reasons I wanted to learn python)... | [
"Hello \nI had the same question because I began to learn Python 2 months ago.\nSo after reading some posts and informations, I decided to start with Python, 2.71, why?:\n1/ Python 2.7.1 is really stable and has all the great libraries.\n2/ It will be maintened for a long time for all the bugs (but not for the func... | [
6,
4,
4,
3
] | [] | [] | [
"compatibility",
"python"
] | stackoverflow_0005538747_compatibility_python.txt |
Q:
Help installing the Swampy python module?
I need to install swampy for the book Think Python. I tried the documentation, but I can't figure it out. I've been trying for a few days and can't continue the book until I install it.
I use Ubuntu.
A:
I fixed the indentation: it should be correct now. The author had ... | Help installing the Swampy python module? | I need to install swampy for the book Think Python. I tried the documentation, but I can't figure it out. I've been trying for a few days and can't continue the book until I install it.
I use Ubuntu.
| [
"I fixed the indentation: it should be correct now. The author had some very strange indentation in his code. \nI also moved two files, danger.gif and words.txt up one level to the main swampy folder. It seems to install for me. I didnt try to use it though, as I am not sure how, and I am not digging into that book... | [
1
] | [] | [] | [
"installation",
"python",
"swampy",
"ubuntu"
] | stackoverflow_0005538465_installation_python_swampy_ubuntu.txt |
Q:
creating variables from external data in python script
I want to read an external data source (excel) and create variables containing the data. Suppose the data is in columns and each column has a header with the variable name.
My first idea is to write a function so i can easily reuse it. Also, I could easily g... | creating variables from external data in python script | I want to read an external data source (excel) and create variables containing the data. Suppose the data is in columns and each column has a header with the variable name.
My first idea is to write a function so i can easily reuse it. Also, I could easily give some additional keyword arguments to make the function m... | [
"Use a dictionary to store your mapping from name to value instead of creating local variable.\ndef get_data(excel_document):\n mapping = {}\n mapping['name1'] = 'value1'\n # ...\n return mapping\n\nmapping = get_data(my_excel)\nfor name, value in mapping:\n # use them\n\nIf you really want to popula... | [
2,
1,
1
] | [] | [] | [
"python",
"scripting"
] | stackoverflow_0005538777_python_scripting.txt |
Q:
Making an numpy array subclass where all shape changing operations return a normal array
I have an array subclass, where some of the extra attributes are only valid for the object's original shape. Is there a way to make sure that all array shape changing operations return a normal numpy array instead of an insta... | Making an numpy array subclass where all shape changing operations return a normal array | I have an array subclass, where some of the extra attributes are only valid for the object's original shape. Is there a way to make sure that all array shape changing operations return a normal numpy array instead of an instance of my class?
I've already written array_wrap, but this doesn't seem to have any effect on ... | [
"If you are not introducing any new members to your NewArrayClass instances, you can reassign the __class__ attribute of the returned instances.\nA.__class__ = np.ndarray\n\nThe point is why would you like to do such a thing. Do you engage in strict type checking elsewhere? You'd go far more with duck typing.\n"
] | [
1
] | [] | [] | [
"numpy",
"python",
"scipy"
] | stackoverflow_0005474844_numpy_python_scipy.txt |
Q:
Unable to debug interactively with Python 2.7
I had asked a question previously on relative paths in python in SO question: How can I access relative paths in Python 2.7 when imported by different modules
The provided answer worked great in all of my scripts and functions. However, when trying to debug the files... | Unable to debug interactively with Python 2.7 | I had asked a question previously on relative paths in python in SO question: How can I access relative paths in Python 2.7 when imported by different modules
The provided answer worked great in all of my scripts and functions. However, when trying to debug the files in IDLE (Python 2.7) it generates run time errors.... | [
"__file__ won't be set if you're writing this in the interpretor.\nSo: \n>>> import os, sys\n>>> curdir = os.path.dirname(__file__)\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\nNameError: name '__file__' is not defined\n\nIs expected.\n__file__ is the name of the file that was calle... | [
3
] | [] | [] | [
"python",
"python_idle"
] | stackoverflow_0005527479_python_python_idle.txt |
Q:
Django - non app specific models.py?
I have multiple Django apps, and I have some code in one of my models.py that really applies to all of the apps. Is there a way to move it somewhere generic, outside of a specific app folder?
Examples of non app specific code I have:
def update_groups(sender, user=None, ldap_u... | Django - non app specific models.py? | I have multiple Django apps, and I have some code in one of my models.py that really applies to all of the apps. Is there a way to move it somewhere generic, outside of a specific app folder?
Examples of non app specific code I have:
def update_groups(sender, user=None, ldap_user=None, **kwargs):
...
django_auth_... | [
"Well, just create a python module somewhere in your project and then refference it in your models. To do this, you need a directory with __init__.py file:\nhelpers/\n __init__.py \n functions.py\n\nPut your code into the functions.py and in any other place you will be able to:\nfrom helpers.functions import up... | [
2,
2,
1
] | [] | [] | [
"django",
"django_models",
"python"
] | stackoverflow_0005538814_django_django_models_python.txt |
Q:
Python image conversion
I have a list of images names which are associated with real resources in file system. For example:
'image1.png'
'image2.jpg'
'image3.jpeg'
I have to conver all of them into png with the same name. How can I do that in python?
The ideas are: using PIL or ImageMagic.
A:
from PIL import Im... | Python image conversion | I have a list of images names which are associated with real resources in file system. For example:
'image1.png'
'image2.jpg'
'image3.jpeg'
I have to conver all of them into png with the same name. How can I do that in python?
The ideas are: using PIL or ImageMagic.
| [
"from PIL import Image\nimport os\nfor filename in filelist:\n basename, ext = os.path.splitext(filename)\n if ext.lower() == \".png\":\n continue\n img = Image.open(filename)\n img.save(basename + \".png\")\n\n"
] | [
4
] | [] | [] | [
"image",
"python"
] | stackoverflow_0005539676_image_python.txt |
Q:
Caching result of setUp() using Python unittest
I currently have a unittest.TestCase that looks like..
class test_appletrailer(unittest.TestCase):
def setup(self):
self.all_trailers = Trailers(res = "720", verbose = True)
def test_has_trailers(self):
self.failUnless(len(self.all_trailers) ... | Caching result of setUp() using Python unittest | I currently have a unittest.TestCase that looks like..
class test_appletrailer(unittest.TestCase):
def setup(self):
self.all_trailers = Trailers(res = "720", verbose = True)
def test_has_trailers(self):
self.failUnless(len(self.all_trailers) > 1)
# ..more tests..
This works fine, but the ... | [
"How about using a class member that only gets initialized once?\nclass test_appletrailer(unittest.TestCase):\n\n all_trailers = None\n\n def setup(self):\n # Only initialize all_trailers once.\n if self.all_trailers is None:\n self.__class__.all_trailers = Trailers(res = \"720\", ver... | [
14,
8,
5,
1,
0
] | [] | [] | [
"python",
"unit_testing"
] | stackoverflow_0000402483_python_unit_testing.txt |
Q:
Facebook wall writing application
I was wondering if i could possible write an app, that could be a list of all my friends and just simply posting a message to their walls on the friends i select. Not a message, a wall post. So it appears that i went to their wall and wrote a message, they have no idea that an app... | Facebook wall writing application | I was wondering if i could possible write an app, that could be a list of all my friends and just simply posting a message to their walls on the friends i select. Not a message, a wall post. So it appears that i went to their wall and wrote a message, they have no idea that an app is pushing the message to them.
also c... | [
"Check the Python SDK for the Facebook Graph API:\nhttp://github.com/facebook/python-sdk\nIn particular, you want the put_wall_post function.\nA short python script making use of this module should fit your needs perfectly.\n",
"Check out the Facebook API. It will more than likely show that the wall post came fro... | [
5,
4,
3,
3,
3,
2
] | [] | [] | [
"facebook",
"php",
"python"
] | stackoverflow_0003327244_facebook_php_python.txt |
Q:
Program that not working properly
I need to write some program that it count until it's found space when its found space the program break to work.
I have been problem.
my code:
x = raw_input("")
i = 0
corents = 0
while(x[i] != " "):
corennts +=i
i+=1
name = x[:corents]
print name
If I will input string ... | Program that not working properly | I need to write some program that it count until it's found space when its found space the program break to work.
I have been problem.
my code:
x = raw_input("")
i = 0
corents = 0
while(x[i] != " "):
corennts +=i
i+=1
name = x[:corents]
print name
If I will input string "Hola amigas" its returns "Hola".
I'm n... | [
"corents is spelt wrong, 5th line down.\nx = raw_input(\"\")\ni = 0\ncorents = 0\nwhile(x[i] != \" \"):\n corents +=i\n i+=1\nname = x[:corents]\nprint name\n\n",
"x = raw_input()\nname = x.split(' ', 1)[0]\nprint name\n\nor\nx = raw_input()\ntry:\n offs = x.index(' ')\n name = x[:offs]\nexcept Value... | [
2,
0,
0
] | [] | [] | [
"python",
"while_loop"
] | stackoverflow_0005539910_python_while_loop.txt |
Q:
Django query: Want to count a set in template
I have a list of item which only displays the latest status of each item. What I want to do now is count. Problem is that is the count function will only work properly if latest is removed - however that would give me something like this.
item1=1 item2=33 item3=12 item... | Django query: Want to count a set in template | I have a list of item which only displays the latest status of each item. What I want to do now is count. Problem is that is the count function will only work properly if latest is removed - however that would give me something like this.
item1=1 item2=33 item3=12 item4=0
Basically it will count all statuses for that ... | [
"Seems to me that all you need is the count of all items that have a status - rather than the count of all statuses related to your items. Is that right? If so, this will do it:\ncount = models.StorageItem.objects.filter(client=client_id, itemstatushistory__isnull=False).count()\n\n"
] | [
0
] | [] | [] | [
"count",
"django",
"html",
"python"
] | stackoverflow_0005539801_count_django_html_python.txt |
Q:
can not update facebook status message
i am using the following code to post status update to a users profile in facebook but every time it just returns could not update what is wrong here ?
def fb_post_message(request):
import urllib2
try:
urllib2.urlopen('https://graph.facebook.com/me/feed',"mes... | can not update facebook status message | i am using the following code to post status update to a users profile in facebook but every time it just returns could not update what is wrong here ?
def fb_post_message(request):
import urllib2
try:
urllib2.urlopen('https://graph.facebook.com/me/feed',"message='hello world'")
except:
ret... | [
"If that is your actual code, and you haven't edited any sensitive information out, then you are not even authenticating to Facebook as a user. So, of course, it won't be able to submit the change.\nI highly recommend using a library designed to interface with Facebook's APIs. For information on Python libraries th... | [
1,
0
] | [] | [] | [
"facebook",
"python"
] | stackoverflow_0003130362_facebook_python.txt |
Q:
Python: subprocess.popen()
I have a question regarding subprocess.popen():
If supposedly the command executed is in a while loop - is there any way for subprocess.popen() to detect it and exit after printing the first output?
Or is there any other way to do this and print the result?
As you see the following progr... | Python: subprocess.popen() | I have a question regarding subprocess.popen():
If supposedly the command executed is in a while loop - is there any way for subprocess.popen() to detect it and exit after printing the first output?
Or is there any other way to do this and print the result?
As you see the following program executed on a linux machine j... | [
"The communicate method is only useful if the program being called is expected to terminate soon with relatively little output. In the case of your example, the \"yes\" program never terminates, so communicate never completes. In order to deal with subprocesses which execute indefinitely, and may produce a lot of o... | [
4
] | [] | [] | [
"python",
"subprocess"
] | stackoverflow_0005539977_python_subprocess.txt |
Q:
Usage of iteritems() in insertion a dict to sqlite3 database
My "video_episodes" table is like:
CREATE TABLE "video_episodes" (
"id" integer NOT NULL PRIMARY KEY,
"dizilink_id" integer NOT NULL REFERENCES "video_dizilink" ("id"),
"episodename" varchar(50) NOT NULL,
"episodeurl" varchar(200) NOT NUL... | Usage of iteritems() in insertion a dict to sqlite3 database | My "video_episodes" table is like:
CREATE TABLE "video_episodes" (
"id" integer NOT NULL PRIMARY KEY,
"dizilink_id" integer NOT NULL REFERENCES "video_dizilink" ("id"),
"episodename" varchar(50) NOT NULL,
"episodeurl" varchar(200) NOT NULL);
I'm trying to insert some values within a dict:
video_links =... | [
"This has nothing to do with iteritems.\nAs the error message says, executemany (why are you using many, rather than simple execute?) takes two arguments, and you are passing three. The parameters to the SQL statement are a single parameter, so need to be wrapped in a tuple.\ncursor.execute(\"\"\"INSERT INTO video_... | [
0
] | [] | [] | [
"python",
"sqlite"
] | stackoverflow_0005540194_python_sqlite.txt |
Q:
How to sort an integer array in-place in Python?
how can one sort an integer array (not a list) in-place in Python 2.6? Is there a suitable function in one of the standard libraries?
In other words, I'm looking for a function that would do something like this:
>>> a = array.array('i', [1, 3, 2])
>>> some_function... | How to sort an integer array in-place in Python? | how can one sort an integer array (not a list) in-place in Python 2.6? Is there a suitable function in one of the standard libraries?
In other words, I'm looking for a function that would do something like this:
>>> a = array.array('i', [1, 3, 2])
>>> some_function(a)
>>> a
array('i', [1, 2, 3])
Thanks in advance!
| [
"Well, you can't do it with array.array, but you can with numpy.array:\nIn [3]: a = numpy.array([0,1,3,2], dtype=numpy.int)\n\nIn [4]: a.sort()\n\nIn [5]: a\nOut[5]: array([0, 1, 2, 3])\n\nOr you can convert directly from an array.array if you have that already: \na = array.array('i', [1, 3, 2])\na = numpy.array(a)... | [
10,
2,
1
] | [] | [] | [
"arrays",
"python",
"sorting"
] | stackoverflow_0005540148_arrays_python_sorting.txt |
Q:
Ironpython query
I have a setup file ready with all the references I need to run the python classes. However, as I do not know much python, I would like to use C# to be able to improve this program as part of my thesis study. I was told IronPython is a wrapper class that can be used to invoke methods on behalf of ... | Ironpython query | I have a setup file ready with all the references I need to run the python classes. However, as I do not know much python, I would like to use C# to be able to improve this program as part of my thesis study. I was told IronPython is a wrapper class that can be used to invoke methods on behalf of python using .NET.
ho... | [
"Maybe this will be useful: http://www.ironpython.net/documentation/dotnet/\n"
] | [
0
] | [] | [] | [
"c#",
"ironpython",
"python",
"reference",
"setup_project"
] | stackoverflow_0005540510_c#_ironpython_python_reference_setup_project.txt |
Q:
How the url internationalization should be made?
I have a question regarding the internationalization of a website's URL addresses.
The question is how to make it properly?
What I would like to do is something like this.
Assume you have an URL in your address bar
www.mydomain.com/en/book
then if you type www.myd... | How the url internationalization should be made? | I have a question regarding the internationalization of a website's URL addresses.
The question is how to make it properly?
What I would like to do is something like this.
Assume you have an URL in your address bar
www.mydomain.com/en/book
then if you type www.mydomain.com/de/book you will be redirected to a german v... | [
"I believe your implementation will work as log as you don't have the same name of to different pages like if you have a page called www.mydomain.com/en/music and if music in German is book, then the problem will be that if you want to go to www.mydomain.com/fr/music then you don't know if you are coming form /de/ ... | [
1,
0
] | [] | [] | [
"internationalization",
"pylons",
"python",
"routing",
"url"
] | stackoverflow_0005539377_internationalization_pylons_python_routing_url.txt |
Q:
How to prevent embedded python to exit() my process
I'm having trouble while running embedded python. It turns out that I can't capture that SystemExit exception raised by sys.exit();
This is what I have so far:
$ cat call.c
#include <Python.h>
int main(int argc, char *argv[])
{
Py_InitializeEx(0);
PySys_... | How to prevent embedded python to exit() my process | I'm having trouble while running embedded python. It turns out that I can't capture that SystemExit exception raised by sys.exit();
This is what I have so far:
$ cat call.c
#include <Python.h>
int main(int argc, char *argv[])
{
Py_InitializeEx(0);
PySys_SetArgv(argc-1, argv+1);
if (PyRun_AnyFileEx(fopen(ar... | [
"PyRun_SimpleFileExFlags function (and all functions using it, including PyRun_AnyFileEx) handles exceptions itself by exiting for SystemExit or printing traceback. Use PyRun_File* family of functions to handle exceptions in surrounding code.\n"
] | [
7
] | [] | [] | [
"embedded",
"exception",
"exit",
"python"
] | stackoverflow_0005540277_embedded_exception_exit_python.txt |
Q:
Simple multiprocessing/threading example in python?
What's the differences between module threading, Thread, multiprocessing? (may be I have badly understood the conceptual differences between multithreads (share memory and global variables?) and multiprocesses (truly independant processes?
Could you please use to... | Simple multiprocessing/threading example in python? | What's the differences between module threading, Thread, multiprocessing? (may be I have badly understood the conceptual differences between multithreads (share memory and global variables?) and multiprocesses (truly independant processes?
Could you please use to illustrate this simple example (calculus doesn't matter)... | [
"No need for answers beyond the documentation\n\n\"\"\"multiprocessing is a package that\n supports spawning processes using an\n API similar to the threading module.\n The multiprocessing package offers\n both local and remote concurrency,\n effectively side-stepping the Global\n Interpreter Lock by using su... | [
2
] | [] | [] | [
"multiprocessing",
"multithreading",
"python"
] | stackoverflow_0005541068_multiprocessing_multithreading_python.txt |
Q:
How to determine if url is being requested from Facebook iFrame?
I have a Google App Engine application and I want to serve a different django template if the request comes in from the Facebook Application. How can I detect that? I don't see anything unique in the Header.
I'm currently using the URL pattern:
r'/... | How to determine if url is being requested from Facebook iFrame? | I have a Google App Engine application and I want to serve a different django template if the request comes in from the Facebook Application. How can I detect that? I don't see anything unique in the Header.
I'm currently using the URL pattern:
r'/user/(.*)'
to map to a "user" request handler. I suppose I could in... | [
".run_wsgi_app(webapp.WSGIApplication([(r'/page/(.*)', Page),\n (r'/user/(.*)', UserProfile),\n (r'/category/(.*)', CategoryProfile), \n (r'/location/(.*)', LocationProfile),\n (r'/facebook/page/(.*)', Page),\n (r'/facebook/user/(.*)', User... | [
1,
0
] | [] | [] | [
"django",
"facebook",
"google_app_engine",
"http",
"python"
] | stackoverflow_0004788764_django_facebook_google_app_engine_http_python.txt |
Q:
Recommendations for Python development on a Mac?
I bought a low-end MacBook about a month ago and am finally getting around to configuring it for Python. I've done most of my Python work in Windows up until now, and am finding the choices for OS X a little daunting. It looks like there are at least five options to... | Recommendations for Python development on a Mac? | I bought a low-end MacBook about a month ago and am finally getting around to configuring it for Python. I've done most of my Python work in Windows up until now, and am finding the choices for OS X a little daunting. It looks like there are at least five options to use for Python development:
"Stock" Apple Python
Mac... | [
"One advantage I see in using the \"stock\" Python that's included with Mac OS X is that it makes deployment to other Macs a piece of cake. I don't know what your deployment scenario is, but for me this is important. My code has to run on any number of Macs at work, and I try to minimize the amount of work it takes... | [
9,
4,
3,
3,
3,
2,
2,
1,
1,
1,
0
] | [] | [] | [
"macos",
"python"
] | stackoverflow_0000601236_macos_python.txt |
Q:
xauth using python-oauth2
I am trying to implement xauth for instapaper using python-oauth2. I am able to find samples for oauth but I didnt find any for xauth. Can someone share samples or the api documentation?
A:
here is the code that worked for me finally
consumer_key=<key>
consumer_secret=<secret>
access_t... | xauth using python-oauth2 | I am trying to implement xauth for instapaper using python-oauth2. I am able to find samples for oauth but I didnt find any for xauth. Can someone share samples or the api documentation?
| [
"here is the code that worked for me finally\n\nconsumer_key=<key>\nconsumer_secret=<secret>\naccess_token_url = 'https://www.instapaper.com/api/1/oauth/access_token'\n\nconsumer = oauth.Consumer(consumer_key, consumer_secret)\nclient = oauth.Client(consumer)\nclient.add_credentials(instaaccount,instapassword)\n\np... | [
11
] | [] | [] | [
"python",
"sample",
"xauth"
] | stackoverflow_0005503260_python_sample_xauth.txt |
Q:
Weird Python Regex Issues
whitespace_pattern = u"\s" # bug: tried to use unicode \u0020, broke regex
time_sig_pattern = \
"""^%(ws)s*time signature:%(ws)s*(?P<top>\d+)%(ws)s*\/%(ws)s*(?P<bottom>\d+)%(ws)s*$""" %{"ws": whitespace_pattern}
time_sig = compile(time_sig_pattern, U|M)
For some rea... | Weird Python Regex Issues | whitespace_pattern = u"\s" # bug: tried to use unicode \u0020, broke regex
time_sig_pattern = \
"""^%(ws)s*time signature:%(ws)s*(?P<top>\d+)%(ws)s*\/%(ws)s*(?P<bottom>\d+)%(ws)s*$""" %{"ws": whitespace_pattern}
time_sig = compile(time_sig_pattern, U|M)
For some reason, adding the Verbose flag, ... | [
"VERBOSE gives you the ability to write comments in your regex to document it.\nIn order to do so, it ignores spaces, since you need to use line breaks to write comments.\nReplace all spaces in your regex by \\s to specify they are spaces you want to match in your pattern, and not just some spaces to format your co... | [
1,
0,
0
] | [] | [] | [
"python",
"regex",
"unicode"
] | stackoverflow_0005541018_python_regex_unicode.txt |
Q:
How can I make a program that runs only when I insert the USB drive?
Let me explain what it's like.
I want a program that's installed in a PC but you can't run it unless you insert a USB drive where some part of the program is stored.
So the point is, the program is useless if you don't have both PC and USB drive.... | How can I make a program that runs only when I insert the USB drive? | Let me explain what it's like.
I want a program that's installed in a PC but you can't run it unless you insert a USB drive where some part of the program is stored.
So the point is, the program is useless if you don't have both PC and USB drive.
Since I want it to run in Windows, what kind of language shall I use apar... | [
"If you're trying to do this for copy protection or license management, there are commercial solutions for this that are very difficult (but still not impossible) to beat. For you to develop something that's robust will end up costing you more than it would cost to license a solution from Pace or Aladdin or any of ... | [
4,
4,
2,
2,
1
] | [] | [] | [
"python",
"windows"
] | stackoverflow_0004978142_python_windows.txt |
Q:
Efficient way to read data in python
Possible Duplicate:
Lazy Method for Reading Big File in Python?
I need to read 100 GB (400 million lines) of data from a file line by line. This is my current code, but is there any efficient method to do this.
I mean in terms of execution speed.
f = open(path, 'r')
for lin... | Efficient way to read data in python |
Possible Duplicate:
Lazy Method for Reading Big File in Python?
I need to read 100 GB (400 million lines) of data from a file line by line. This is my current code, but is there any efficient method to do this.
I mean in terms of execution speed.
f = open(path, 'r')
for line in f:
...
f.close()
| [
"If the lines are of fixed byte length, and the lines do not have to be read in any particular order (you can still know the line number though), than you can easily split it into parallel subtasks, executing in multiple threads/processes. Each subtusk would only need to know to where to seek() and how many bytes t... | [
2,
2
] | [] | [] | [
"python"
] | stackoverflow_0005539768_python.txt |
Q:
Fastest Way to Write Data To Individual Machines?
I have a network of 100 machines, all running Ubuntu Linux.
On a continuous (streaming) basis, machine X is 'fed' with some real-time data. I need to write a python script that would get the data as input, load it in-memory, process it, and then save it to disk.
It... | Fastest Way to Write Data To Individual Machines? | I have a network of 100 machines, all running Ubuntu Linux.
On a continuous (streaming) basis, machine X is 'fed' with some real-time data. I need to write a python script that would get the data as input, load it in-memory, process it, and then save it to disk.
It's a lot of data, hence, I would ideally want to split ... | [
"You should take a look at pyzmq:\nhttp://www.zeromq.org/bindings:python\nand general guides to zeromq (0mq)\nhttp://nichol.as/zeromq-an-introduction\nhttp://www.zeromq.org/\n",
"You have two (classes of) choices:\n\nYou could build some distribution mechanism yourself.\nYou could use an existing tool to handle t... | [
5,
3,
2
] | [] | [] | [
"linux",
"python"
] | stackoverflow_0005541615_linux_python.txt |
Q:
Discretization of a diff. equation gives weird results
I have a code in Python that draws wave functions and energy for different potentials:
# -*- coding: cp1250 -*-
from math import *
from scipy.special import *
from pylab import *
from scipy.linalg import *
firebrick=(178./255.,34./255.,34./255.)
indianred... | Discretization of a diff. equation gives weird results | I have a code in Python that draws wave functions and energy for different potentials:
# -*- coding: cp1250 -*-
from math import *
from scipy.special import *
from pylab import *
from scipy.linalg import *
firebrick=(178./255.,34./255.,34./255.)
indianred=(176./255.,23./255.,31./255.)
steelblue=(70./255.,130./255.... | [
"Use select argument for eig_banded():\n#!/usr/bin/env python\nfrom __future__ import division\nimport functools\nimport math\nimport sys\n\nfrom timeit import default_timer as timer\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.linalg as linalg\n\ndef report_time(func):\n @functools.wraps... | [
2
] | [] | [] | [
"python",
"scipy"
] | stackoverflow_0005528803_python_scipy.txt |
Q:
How to add a Facebook Event with new Graph API
I am trying to create an event using Facebooks api. (From a django app) Has anyone created an event with the new graph api?
A:
Check here:
http://developers.facebook.com/docs/api#publishing
Make a POST call to /PROFILE_ID/events with the required informations. Unfo... | How to add a Facebook Event with new Graph API | I am trying to create an event using Facebooks api. (From a django app) Has anyone created an event with the new graph api?
| [
"Check here:\nhttp://developers.facebook.com/docs/api#publishing\nMake a POST call to /PROFILE_ID/events with the required informations. Unfortunately they don't have all the possible arguments listed, but they can be found in the REST API docs under Events.create.\n",
"To Create Event you can use below code: (Wh... | [
7,
5,
2
] | [
"There appears to be no documented method for creating an API in the new docs, but you can use the REST interface methods as described here: http://developers.facebook.com/docs/reference/rest/ .\nThe big show stopper for me at the moment is the requirement of a user session to run any of the REST interfaces. A lot ... | [
-1
] | [
"django",
"facebook",
"facebook_graph_api",
"python"
] | stackoverflow_0002690971_django_facebook_facebook_graph_api_python.txt |
Q:
Applescript uses wrong python version, how to change?
I recently installed python 2.6.5 over 2.6.1 on OS X. Everything works fine except when I try executing python scripts via the Applescript editor. If I execute the following line I get version 2.6.1:
Applescript:
do shell script "python -c \"from sys import ver... | Applescript uses wrong python version, how to change? | I recently installed python 2.6.5 over 2.6.1 on OS X. Everything works fine except when I try executing python scripts via the Applescript editor. If I execute the following line I get version 2.6.1:
Applescript:
do shell script "python -c \"from sys import version; print version\""
But if I execute the similar line i... | [
"I won't recommend overwriting system-installed python (or whatever UNIX commands,) because some of the system app might depend on the quirk of a particular version of python installed. \nIt's quite customary these days to install another distinct copy of python (or perl or ruby) in an entirely different path. \nTh... | [
1,
0,
0
] | [] | [] | [
"applescript",
"macos",
"python",
"version"
] | stackoverflow_0003068951_applescript_macos_python_version.txt |
Q:
Python: Splitting a string into words, saving separators
I have a string:
'Specified, if char, else 10 (default).'
I want to split it into two tuples
words=('Specified', 'if', 'char', 'else', '10', 'default')
separators=(',', ' ', ',', ' ', ' (', ').')
Does anyone have a quick solution of this?
PS: this symbol... | Python: Splitting a string into words, saving separators | I have a string:
'Specified, if char, else 10 (default).'
I want to split it into two tuples
words=('Specified', 'if', 'char', 'else', '10', 'default')
separators=(',', ' ', ',', ' ', ' (', ').')
Does anyone have a quick solution of this?
PS: this symbol '-' is a word separator, not part of the word
| [
"import re\nline = 'Specified, if char, else 10 (default).'\nwords = re.split(r'\\)?[, .]\\(?', line)\n# words = ['Specified', '', 'if', 'char', '', 'else', '10', 'default', '']\nseparators = re.findall(r'\\)?[, .]\\(?', line)\n# separators = [',', ' ', ' ', ',', ' ', ' ', ' (', ').']\n\nIf you really want tuples p... | [
5,
1,
1,
0,
0,
0
] | [] | [] | [
"python"
] | stackoverflow_0005542257_python.txt |
Q:
Python win32: FillSolidRect only works if call >= 20 times
I'm trying to draw a rectangle on my screen using the win32 python libs. For some reason it works if I call FillSolidRect 20 times in a row, but if I call it less than that it doesn't work. Can anybody give a hint as to why?
import time
from ctypes impo... | Python win32: FillSolidRect only works if call >= 20 times | I'm trying to draw a rectangle on my screen using the win32 python libs. For some reason it works if I call FillSolidRect 20 times in a row, but if I call it less than that it doesn't work. Can anybody give a hint as to why?
import time
from ctypes import windll
from win32api import GetSystemMetrics
import win32ui, ... | [
"Windows queues/batches certain GDI operations to enhance performance. See GdiFlush for more information on how to override this.\n"
] | [
1
] | [] | [] | [
"python",
"winapi",
"windows"
] | stackoverflow_0005519199_python_winapi_windows.txt |
Q:
COM Local Server (Out of process) w/ Python
I have a question related to Python and COM.
I have been given a program which is an out-of-process COM local server (it is an .EXE). It is designed to be a Singleton, so there is always only one instance running on a machine. It is designed to support multiple clients. ... | COM Local Server (Out of process) w/ Python | I have a question related to Python and COM.
I have been given a program which is an out-of-process COM local server (it is an .EXE). It is designed to be a Singleton, so there is always only one instance running on a machine. It is designed to support multiple clients. My question is how do I create a Python client to... | [
"Yes your question is a little vague. It sounds like your problem is just the \"talking to COM\" side of things - ie. not the singleton server stuff. I managed to work this out from the Win23com docs, and I think a chapter in a book (which I've since passed on - but I think it was an O'Reilly learning python type ... | [
0
] | [] | [] | [
"com",
"python"
] | stackoverflow_0005542197_com_python.txt |
Q:
Mac OS X file browser using tkFileDialog not working
I have an application that I am attempting to build on Mac OS X that is primarily python and uses tk as its gui.
It appeared to build okay and I can see the GUI, but when I click the browse button, which invokes tkFileDialog.askopenfilename(**options), I am no... | Mac OS X file browser using tkFileDialog not working | I have an application that I am attempting to build on Mac OS X that is primarily python and uses tk as its gui.
It appeared to build okay and I can see the GUI, but when I click the browse button, which invokes tkFileDialog.askopenfilename(**options), I am not getting an option to select the file type and therefore ... | [
"Which extension do you want to open?\nTry\noptions['filetypes'] = [('all files', '.*'), ('text files', '.txt')]\nOr if you completely remove this line Tk should (as per the docs) list all available files. The same happens when the file type selection is not supported on your Tk / platform combination.\n"
] | [
1
] | [] | [] | [
"macos",
"python",
"tkinter"
] | stackoverflow_0005542338_macos_python_tkinter.txt |
Q:
finding smallest number in list for python
I am trying to use a for loop to get an average for each week and for the month in python:
sum = 0
sumA = 0
sumB = 0
sumC = 0
sumD = 0
week1 = (35,38,30,34,27,40,39)
week2 = (35,38,30,34,27,40,39)
week3 = (35,38,30,34,27,40,39)
week4 = (35,38,30,34,27,40,39)
for x in (w... | finding smallest number in list for python | I am trying to use a for loop to get an average for each week and for the month in python:
sum = 0
sumA = 0
sumB = 0
sumC = 0
sumD = 0
week1 = (35,38,30,34,27,40,39)
week2 = (35,38,30,34,27,40,39)
week3 = (35,38,30,34,27,40,39)
week4 = (35,38,30,34,27,40,39)
for x in (week1):
sum = sum + week1[x]
avg1 = (sum ... | [
"Assuming you are using Python 2.x, the / operator for two integers uses integer divsion, i. e. the result of the division is rounded down to the next integer. Try it in the interactive interpreter:\n>>> 5/3\n1\n\nTo get the correct floating point division, either use\nfrom __future__ import division\n\nor convert... | [
5,
4,
3,
2,
1
] | [] | [] | [
"python"
] | stackoverflow_0005543341_python.txt |
Q:
Unicode characters with BlobStore in App Engine
Is there a way to store unicode data with App Engine's BlobStore (in Python)?
I'm saving the data like this
file_name = files.blobstore.create(mime_type='application/octet-stream')
with files.open(file_name, 'a') as f:
f.write('<as><a>' + '</a><a>'.join(stringIn... | Unicode characters with BlobStore in App Engine | Is there a way to store unicode data with App Engine's BlobStore (in Python)?
I'm saving the data like this
file_name = files.blobstore.create(mime_type='application/octet-stream')
with files.open(file_name, 'a') as f:
f.write('<as><a>' + '</a><a>'.join(stringInUnicode) + '</a></as>')
But on the production (not d... | [
"A BLOB store contains binary data: bytes, not characters. So you're going to have to do an encode step of some sort. utf-8 seems as good an encoding as any.\nf.write('<as><a>' + '</a><a>'.join(stringInUnicode) + '</a></as>')\n\nThis will go wrong if an item in stringInUnicode contains <, & or ]]> sequences. You'll... | [
5
] | [] | [] | [
"google_app_engine",
"python",
"unicode"
] | stackoverflow_0005541040_google_app_engine_python_unicode.txt |
Q:
What can you execute on visually selected text in vim?
What are the possible operations (with keyboard shortcuts) that you could execute on a visually selected text? For the simplicity consider this simple piece:
a b cd 1 p
a b cd 2 y
a b cd 3 t
a b cd 4 h
a b cd 5 o
a b cd ... | What can you execute on visually selected text in vim? | What are the possible operations (with keyboard shortcuts) that you could execute on a visually selected text? For the simplicity consider this simple piece:
a b cd 1 p
a b cd 2 y
a b cd 3 t
a b cd 4 h
a b cd 5 o
a b cd 6 n
One specific question: is it possible to execute Pyth... | [
"This question is extremely broad, but to start with look at :help visual-operators.\nRegarding the specific question, check out the plugin EvalSelection.vim, which evaluates source code selected in a visual region in your shell, Python, and several other interpreters. As a very simple example, if you have the foll... | [
5,
4
] | [] | [] | [
"python",
"vi",
"vim"
] | stackoverflow_0003752785_python_vi_vim.txt |
Q:
Call a function in Python and pass only the arguments it expects
How do I call a function and only pass it the arguments that it expects. For example say I have the following functions:
func1 = lambda a: True
func2 = lambda a, b: True
func3 = lambda c: True
I want some Python code that is able to successfully cal... | Call a function in Python and pass only the arguments it expects | How do I call a function and only pass it the arguments that it expects. For example say I have the following functions:
func1 = lambda a: True
func2 = lambda a, b: True
func3 = lambda c: True
I want some Python code that is able to successfully call these functions without raising a TypeError by passing unexpected ar... | [
"You can use inspect.getargspec():\nfrom inspect import getargspec\nkwargs = dict(a=1, b=2, c=3)\nfor func in (func1, func2, func3):\n func(**dict((name, kwargs[name]) for name in getargspec(func)[0]))\n\n",
"Well, depending on exactly what you will want to do with variable arguments and keyword arguments, the... | [
10,
4
] | [] | [] | [
"python"
] | stackoverflow_0005543870_python.txt |
Q:
Python function decorator calls
I have a function that is called about 1742 times but when i do a decorator to calculate each call time of it i found that it prints only 647 times i don't know why that happens.
Update:
My problem here is not with how to make timing its with the difference between the number of c... | Python function decorator calls | I have a function that is called about 1742 times but when i do a decorator to calculate each call time of it i found that it prints only 647 times i don't know why that happens.
Update:
My problem here is not with how to make timing its with the difference between the number of calls, I want a way to make a decorato... | [
"I saw your pasted code - on the pastebin. The problem is that you are wrapping the __iter__ method of a class. It is only called once for each loop that is started. And it shoud return imediatelly with an iterator object -- what would be profilable is the calls to the \"next\" method on the object returned by __it... | [
5
] | [] | [] | [
"decorator",
"python"
] | stackoverflow_0005542993_decorator_python.txt |
Q:
Computing Standard Deviation in a stream
Using Python, assume I'm running through a known quantity of items I, and have the ability to time how long it takes to process each one t, as well as a running total of time spent processing T and the number of items processed so far c. I'm currently calculating the averag... | Computing Standard Deviation in a stream | Using Python, assume I'm running through a known quantity of items I, and have the ability to time how long it takes to process each one t, as well as a running total of time spent processing T and the number of items processed so far c. I'm currently calculating the average on the fly A = T / c but this can be skewed ... | [
"As outlined in the Wikipedia article on the standard deviation, it is enough to keep track of the following three sums:\ns0 = sum(1 for x in samples)\ns1 = sum(x for x in samples)\ns2 = sum(x*x for x in samples)\n\nThese sums are easily updated as new values arrive. The standard deviation can be calculated as\nst... | [
52,
27,
17
] | [] | [] | [
"math",
"python"
] | stackoverflow_0005543651_math_python.txt |
Q:
Yahoo! OpenID doesn't include Attribute Exchange info (using python-openid)
I'm using python-openid to successfully connect my python based site with OpenID. It works great with Google and it works with Yahoo! but with Yahoo! the Attribute Exchange doesn't seem to work. I only ever get the email address. firstname... | Yahoo! OpenID doesn't include Attribute Exchange info (using python-openid) | I'm using python-openid to successfully connect my python based site with OpenID. It works great with Google and it works with Yahoo! but with Yahoo! the Attribute Exchange doesn't seem to work. I only ever get the email address. firstname, lastname and country is always blank. I know the Yahoo! account (by that email ... | [
"Better late than never, perhaps. I was just testing this same thing in Perl, using the Net::OpenID::Consumer package, and had similar issues. I first discovered that firstname and lastname are not available from yahoo, instead you must define another type pointing to the axschema type http://axschema.org/namePer... | [
2
] | [] | [] | [
"openid",
"python",
"python_openid"
] | stackoverflow_0002664127_openid_python_python_openid.txt |
Q:
Assigning a value to Python list doesn't work?
The following code works properly for me:
# -*- coding: utf-8 -*-
N = int(raw_input("N="))
l=[]
i = 0
while i<N:
n = raw_input("e"+str(i)+"=")
l.append(n)
i = i+1
print l
But, why can't I simplify it by using l[i] = raw_input("e"+str(i)+"=") instead?
E... | Assigning a value to Python list doesn't work? | The following code works properly for me:
# -*- coding: utf-8 -*-
N = int(raw_input("N="))
l=[]
i = 0
while i<N:
n = raw_input("e"+str(i)+"=")
l.append(n)
i = i+1
print l
But, why can't I simplify it by using l[i] = raw_input("e"+str(i)+"=") instead?
Example: (doesn't work)
# -*- coding: utf-8 -*-
N = i... | [
"You can only use indexing (e.g. obj[x]) to access or modify items that already exist in a list. For example, the following works because the positions in the list that we are accessing already exist:\n>>> chars = ['a', 'b', 'c']\n>>> chars[0]\n'a'\n>>> chars[0] = 'd'\n>>> chars\n['d', 'b', 'c']\n\nHowever, accessi... | [
11,
7,
3,
1
] | [] | [] | [
"python"
] | stackoverflow_0005544228_python.txt |
Q:
django template syntax to iterate through two lists
I have the following django template, where as I'm iterating through a list (class_list_overall), I want to use forloop.counter0 as an index in another list (classTimeSlots). It just keeps giving me a TemplateSyntaxError. I have tried the following variations:
{... | django template syntax to iterate through two lists | I have the following django template, where as I'm iterating through a list (class_list_overall), I want to use forloop.counter0 as an index in another list (classTimeSlots). It just keeps giving me a TemplateSyntaxError. I have tried the following variations:
{{classTimeSlots.{{forloop.counter0}}}}
{{classTimeSlots.[... | [
"Short answer: you can't do that.\nThe template language will not try to determine the value of a variable passed in dot syntax. \nIt will do a literal lookup of forloop.counter0\n1: write a template tag that accepts a variable and a key, and have it return the variable[key]\n2: this can most likely be done in the ... | [
2,
2,
0
] | [] | [] | [
"django",
"google_app_engine",
"python"
] | stackoverflow_0005533268_django_google_app_engine_python.txt |
Q:
Where shall I start in making a scraper or a bot using python?
I'm not that new in programming languages(python) but I got no clue on where will I start in making a bot or a scraper using python?. should I study in cgi programming? or does the scraper runs just using a python script? Should I build a server for th... | Where shall I start in making a scraper or a bot using python? | I'm not that new in programming languages(python) but I got no clue on where will I start in making a bot or a scraper using python?. should I study in cgi programming? or does the scraper runs just using a python script? Should I build a server for that? Got no clue for this... thanks for the help
| [
"Here are some links to get you started.\n\nBuild a basic web scraper in Python\nScrapy: An open source web scraping framework for Python\nWeb scraping with Python. Part 1: Crawling\n\n",
"If you’re trying to access websites that make heavy use of JavaScript, you might, overall, find Selenium easier.\nSelenium is... | [
9,
2,
1
] | [] | [] | [
"cgi",
"python"
] | stackoverflow_0003075792_cgi_python.txt |
Q:
Static css file and xdv
What is the correct method to manage css file versioning using collective.xdv?
Now I use nginx to serve css directly. I tried to import them in the css_registry, but if I change a file the merged css doesn't update, I mean, its version number (eg. the 4931 in rescsstylesheets-cachekey4931.c... | Static css file and xdv | What is the correct method to manage css file versioning using collective.xdv?
Now I use nginx to serve css directly. I tried to import them in the css_registry, but if I change a file the merged css doesn't update, I mean, its version number (eg. the 4931 in rescsstylesheets-cachekey4931.css) doesn't get incremented.
... | [
"that's not a version number. that's portal_css tool that merges and caches CSS files together for better performance.\nWhile developing you have to enable CSS/JS debug in order to see changes in real time. Go to ZMI -> portal_css/javascript and check \"debug mode\" flag to be on.\nIf I'm not wrong, from plone 4.x ... | [
3,
3,
1,
1
] | [] | [] | [
"css",
"plone",
"python",
"xdv"
] | stackoverflow_0005535714_css_plone_python_xdv.txt |
Q:
How to convert a unicode key name so amazon-s3 will recognize it?
In a django application, I am receiving a POST variable with a name of a file uploaded into amazon s3.
But I receive the key in unicode, and when I pass the key to boto and amazon s3, nothing is returned. However if I list the bucket with boto, and... | How to convert a unicode key name so amazon-s3 will recognize it? | In a django application, I am receiving a POST variable with a name of a file uploaded into amazon s3.
But I receive the key in unicode, and when I pass the key to boto and amazon s3, nothing is returned. However if I list the bucket with boto, and get the key from the list, then amazon s3 returns the object expected.... | [
"'37' and '38' are different strings. It will probably work fine when you use the correct value.\n"
] | [
5
] | [] | [] | [
"amazon_s3",
"boto",
"python",
"unicode"
] | stackoverflow_0005544465_amazon_s3_boto_python_unicode.txt |
Q:
How do I figure out the format for struct.unpack (because I didn't pack in Python)?
I have a C pipe client (pulled directly from the CallNamedPipe example found here) that, if given the string "first", sends the following message to my Python pipeserver:
b'f\x00i\x00r\x00s\x00t\x00\x00\x00'
The struct documentati... | How do I figure out the format for struct.unpack (because I didn't pack in Python)? | I have a C pipe client (pulled directly from the CallNamedPipe example found here) that, if given the string "first", sends the following message to my Python pipeserver:
b'f\x00i\x00r\x00s\x00t\x00\x00\x00'
The struct documentation gives examples where I did both the packing and unpacking in Python. That means I know... | [
">>> b'f\\x00i\\x00r\\x00s\\x00t\\x00\\x00\\x00'.decode('utf-16le')\nu'first\\x00'\n\n\"The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)\"\n",
"Your C code is not writing a struct to the pipe, it is writing a null-terminated string encod... | [
3,
2
] | [] | [] | [
"python",
"python_3.x"
] | stackoverflow_0005544477_python_python_3.x.txt |
Q:
2D RTS in Python?
I am a great python fan. Recently I got an idea to write RTS engine and/or maybe a simple RTS game based upon this engine. There are a couple of things I need to think about and maybe you can give me some advice on these:
Performance. Most games are written in C++. Isn't python too slow for game... | 2D RTS in Python? | I am a great python fan. Recently I got an idea to write RTS engine and/or maybe a simple RTS game based upon this engine. There are a couple of things I need to think about and maybe you can give me some advice on these:
Performance. Most games are written in C++. Isn't python too slow for game engine? I am aiming on... | [
"\nPerformance may be an issue with heavy graphics/math processing. If so, see Panda3D, NumPy, Cython, and PyPy.\nUse Pyglet, PyOpenGL with Pyglet, Panda3D (although you are writing in 2D, you can still use a 3D engine), or perhaps some other library.\nThere don't seem to be existing RTS libraries, but there are de... | [
7,
3
] | [] | [] | [
"graphics",
"performance",
"python",
"real_time_strategy"
] | stackoverflow_0005544634_graphics_performance_python_real_time_strategy.txt |
Q:
Combining multiple for loops in Python
Let's say, we have and list of objects in variable called "articles", each object has a member "tags" (which is simple list).
Expected output: all tags in all articles, joined in a single list.
In multiple lines, solution would be:
arr = []
for article in articles:
for ta... | Combining multiple for loops in Python | Let's say, we have and list of objects in variable called "articles", each object has a member "tags" (which is simple list).
Expected output: all tags in all articles, joined in a single list.
In multiple lines, solution would be:
arr = []
for article in articles:
for tag in article.tags:
arr.append(tag)
N... | [
"It's invalid because article doesn't exist by the time the first loop is parsed.\narr = [tag for article in articles for tag in article.tags]\n\n",
"You are actually looping in the order that you don't want to order:\nwhat you want is:\nresult = [ tag for article in articles for tag in article.tags ]\n\nTo trans... | [
11,
5,
4,
2,
2,
2
] | [] | [] | [
"python"
] | stackoverflow_0005544549_python.txt |
Q:
How can I redirect to a view with a parameter?
I'm trying to follow the instructinons for redirect in Django. I want to redirect to a page and then redirect back again. Here's my code:
def home(request):
current_user = None
if 'user_id' in request.session.keys():
current_user = request.session['us... | How can I redirect to a view with a parameter? | I'm trying to follow the instructinons for redirect in Django. I want to redirect to a page and then redirect back again. Here's my code:
def home(request):
current_user = None
if 'user_id' in request.session.keys():
current_user = request.session['user_id']
else:
return redirect('update_se... | [
"what you're doing in the view is correct, it's just that the parameter next is missing from the url:\nurl(r'^/ldap/(?P<next>\\w+)/$', \n 'library.views.update_session_from_ldap',\n name=\"ldap\")\n\nBut I see that you're not using the next parameter in update_session_from_ldap. If you want to always redirect... | [
2,
1
] | [] | [] | [
"django",
"python"
] | stackoverflow_0005542359_django_python.txt |
Q:
Retrieve a task result object, given a `task_id` in Celery
I store the task_id from an celery.result.AsyncResult in a database and relate it to the item that the task affects. This allows me to perform a query to retrieve all the task_ids of tasks that relate to a specific item.
So after retrieving the task_id fro... | Retrieve a task result object, given a `task_id` in Celery | I store the task_id from an celery.result.AsyncResult in a database and relate it to the item that the task affects. This allows me to perform a query to retrieve all the task_ids of tasks that relate to a specific item.
So after retrieving the task_id from the database, how do I go about retrieving information about t... | [
"From the Celery FAQ:\nresult = MyTask.AsyncResult(task_id)\nresult.get()\n\n"
] | [
67
] | [] | [] | [
"celery",
"python"
] | stackoverflow_0005544611_celery_python.txt |
Q:
How to write a Python robot that browses
Possible Duplicate:
Where shall I start in making a scraper or a bot using python?
I know it's obviously possible...
I was asked to implement some sort of robot that visits a website, logs in, visits a set of links, fills a search form with date inputs to get a XLS file a... | How to write a Python robot that browses |
Possible Duplicate:
Where shall I start in making a scraper or a bot using python?
I know it's obviously possible...
I was asked to implement some sort of robot that visits a website, logs in, visits a set of links, fills a search form with date inputs to get a XLS file and logs off.
If done manually this whole orde... | [
"I am a fan of the twill python module. Here is a small sample of the code from it that I used not too long ago to do basic browsing and scraping.\nimport twill\nimport twill.commands as c\n\ndef login():\n c.clear_cookies()\n c.go('http://icfpcontest.org/icfp10/login')\n c.fv(1, 'j_username', 'Side Effec... | [
3,
0
] | [] | [] | [
"python",
"robot"
] | stackoverflow_0005544008_python_robot.txt |
Q:
Kill Process from Makefile
I'm trying to write a makefile that will replicate a client/server program I've written (which is really just two Python scripts, but that's not the real question of concern)...
test:
python server.py 7040 &
python subscriber.py localhost 7040 &
python client.py localhost 70... | Kill Process from Makefile | I'm trying to write a makefile that will replicate a client/server program I've written (which is really just two Python scripts, but that's not the real question of concern)...
test:
python server.py 7040 &
python subscriber.py localhost 7040 &
python client.py localhost 7040;
So I run make test
and I ge... | [
"Use plain old bash in the script, get the PID and use kill.\nOr, much much much much better, create a testing script that handles all that and call that from your Makefile. A single run_tests.py, say.\nYou want to keep as much logic as possible outside the Makefile.\n",
"related to 'global' issue => define handl... | [
5,
0
] | [] | [] | [
"makefile",
"pid",
"python"
] | stackoverflow_0005544706_makefile_pid_python.txt |
Q:
OAuth2 client that works on App Engine
Can anyone advice me on a good library or else how to go about having a Python appengine based application using OAuth to authenticate to another server?
I have an application on appengine that expects user input. I would like the user to be able to upload an image, which I w... | OAuth2 client that works on App Engine | Can anyone advice me on a good library or else how to go about having a Python appengine based application using OAuth to authenticate to another server?
I have an application on appengine that expects user input. I would like the user to be able to upload an image, which I would put in imgur.com and would be able to s... | [
"Have a look to python-oauth2 project.\nA Client example:\nimport oauth2 as oauth\n\n# Create your consumer with the proper key/secret.\nconsumer = oauth.Consumer(key=\"your-twitter-consumer-key\", \n secret=\"your-twitter-consumer-secret\")\n\n# Request token URL for Twitter.\nrequest_token_url = \"http://twitt... | [
4,
1,
0
] | [] | [] | [
"google_app_engine",
"oauth",
"python"
] | stackoverflow_0005475571_google_app_engine_oauth_python.txt |
Q:
GeoIP with google app engine and python
I am trying to add the following feature to my application.
Sequence of actions:
User goes to the web application
Web application detects the country and city based on the users IP address
Web application automatically selects users country and city and shows it to the user... | GeoIP with google app engine and python | I am trying to add the following feature to my application.
Sequence of actions:
User goes to the web application
Web application detects the country and city based on the users IP address
Web application automatically selects users country and city and shows it to the user.
I tried searching for this and even asked ... | [
"If you need to do this server-side then you will need to get hold of one of the databases that map IP addresses to countries/cities. These databases go out of date requenquently and so are usually commercial. Maxmind have various licences for their database including some free ones I believe.\nHowever, if you coul... | [
6,
0
] | [] | [] | [
"google_app_engine",
"python"
] | stackoverflow_0005369795_google_app_engine_python.txt |
Q:
Application build/deployment for python
Just really looking to develop a good build/deployment strategy for python web applications written in mostly django/web.py. I currently only utilize setuptools to get my dependencies, but would like to see what others are doing
A:
We use zc.buildout to create repeatable d... | Application build/deployment for python | Just really looking to develop a good build/deployment strategy for python web applications written in mostly django/web.py. I currently only utilize setuptools to get my dependencies, but would like to see what others are doing
| [
"We use zc.buildout to create repeatable development and deployment setups. During development, mr.developer is an unmissable extension. \nIt's important you use a versions section to pin all egg versions though to ensure your buildout is repeatable at all times. Setting the allow-picked-versions option to false wi... | [
1
] | [] | [] | [
"build",
"python",
"setup_deployment"
] | stackoverflow_0005545224_build_python_setup_deployment.txt |
Q:
mod_wsgi on archlinux with python 3.2
I actually had mod_wsgi working with python3.1, but after updating some software... it no longer works.
I followed these instructions for python3.1 modified slightly for 3.2:
https://wiki.archlinux.org/index.php/Mod_wsgi
and while it seems to build/install ok, trying to start ... | mod_wsgi on archlinux with python 3.2 | I actually had mod_wsgi working with python3.1, but after updating some software... it no longer works.
I followed these instructions for python3.1 modified slightly for 3.2:
https://wiki.archlinux.org/index.php/Mod_wsgi
and while it seems to build/install ok, trying to start apache give me the error :
Cannot load /etc... | [
"The released versions of mod_wsgi cannot be used with Python 3.2. You must currently use source code directly from subversion repository for mod_wsgi. See:\nhttp://code.google.com/p/modwsgi/source/checkout\n"
] | [
3
] | [] | [] | [
"archlinux",
"mod_wsgi",
"python",
"python_3.2",
"wsgi"
] | stackoverflow_0005544756_archlinux_mod_wsgi_python_python_3.2_wsgi.txt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.