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:
building Python py2app issue on Mac
I am trying to build an MacOS app using Python and py2app. The build error I get is
No such file or directory: '/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bundletemplate/prebuilt/main-i386'
I searched in multiple directories and files but I am unable to d... | building Python py2app issue on Mac | I am trying to build an MacOS app using Python and py2app. The build error I get is
No such file or directory: '/Library/Python/2.6/site-packages/py2app-0.5.2-py2.6.egg/py2app/bundletemplate/prebuilt/main-i386'
I searched in multiple directories and files but I am unable to determine where Python or py2app is gettin... | [
"better use to version 0.5.3.\nsvn co http://svn.pythonmac.org/py2app/py2app/trunk py2app\ncd py2app\nsudo /usr/bin/python setup.py install\nls /Library/Python/2.6/site-packages/py2app-0.5.3-py2.6.egg/py2app/bundletemplate/prebuilt/\nmain-fat main-fat3 main-i386 main-intel main-ppc main-pp... | [
1
] | [] | [] | [
"py2app",
"python"
] | stackoverflow_0005188068_py2app_python.txt |
Q:
use of <$nopage> in python try-except block
I am seeing use of <$nopage> in some python scripts online and in a pdf file. I have googled for what it stands for. But could not get information about it. To be specific, in the PDF version of the book, Core Python Programming, I see this <$nopage> construct many times... | use of <$nopage> in python try-except block | I am seeing use of <$nopage> in some python scripts online and in a pdf file. I have googled for what it stands for. But could not get information about it. To be specific, in the PDF version of the book, Core Python Programming, I see this <$nopage> construct many times. But on the online version (Safari Books) of the... | [
"It means nothing in the context of Python at all. It's probably a mistake in the PDF rendering. I'm guessing it's a statement to prevent page breaks in the code.\nUpdate: I finally found an example here:\nhttp://raninho.com.br/~paper/Python/O%27Reilly%20-%20Core%20Python/237.html\nThat is indeed not python code, b... | [
3
] | [] | [] | [
"python"
] | stackoverflow_0005194169_python.txt |
Q:
Parsing response from Github
How do I make string like "payload={'key':'value'...}" to become a variable payload with value assigned to it "{'key':'value'...}"? Thanks.
A:
Like they said on github, use a query string parser, like this:
import urlparse
str = "payload={'key':'value'}"
print urlparse.parse_qs(str)
... | Parsing response from Github | How do I make string like "payload={'key':'value'...}" to become a variable payload with value assigned to it "{'key':'value'...}"? Thanks.
| [
"Like they said on github, use a query string parser, like this:\nimport urlparse\nstr = \"payload={'key':'value'}\"\nprint urlparse.parse_qs(str)\n\nResult is this:\n{'payload': [\"{'key':'value'}\"]}\n\n",
"payload = json.loads(jsonstring)\npayload = pickle.loads(pickstring)\n\nDon't pickle untrusted data.\n"
] | [
2,
0
] | [] | [] | [
"python"
] | stackoverflow_0005194091_python.txt |
Q:
Using a different version of zlib.so than the system's using Python cdll import
Greetings,
I'm trying to modify zlib and test behaviors, so I wrote mylib.c and mylib.h. This forms a wrapper for calling zlib functions internally (like InflateInit2()). I am compiling/linking with the following commands:
gcc -g -Wa... | Using a different version of zlib.so than the system's using Python cdll import | Greetings,
I'm trying to modify zlib and test behaviors, so I wrote mylib.c and mylib.h. This forms a wrapper for calling zlib functions internally (like InflateInit2()). I am compiling/linking with the following commands:
gcc -g -Wall -Werror -c -std=c99 -I./zlib-1.2.5 -I./ -fPIC mylib.c
gcc -shared mylib.o -o myli... | [
"I believe the Python source links statically against a bundled copy of zlib. To get Python to use your version you'll probably need to download the Python source and build a custom interpreter with your modified zlib source swapped in place.\n# system python static lib bundles the zlibmodule.o code\nares% nm -ao ... | [
1
] | [] | [] | [
"c",
"python",
"shared_libraries"
] | stackoverflow_0005194092_c_python_shared_libraries.txt |
Q:
Pylons Paster not reloading code
Possible Duplicate:
Paste (Python) Web Server - Autoreload Problem
I have a pylons app in development. I start the app with paster serve --reload --daemon development.ini. I have apache in front of the app using ProxyPass. Since this site is in dev i want the code to reload when... | Pylons Paster not reloading code |
Possible Duplicate:
Paste (Python) Web Server - Autoreload Problem
I have a pylons app in development. I start the app with paster serve --reload --daemon development.ini. I have apache in front of the app using ProxyPass. Since this site is in dev i want the code to reload when i change the source files. I thought... | [
"I don't think --daemon and --reload are compatible. --daemon is meant to really launch and run constantly. If you need to keep it running in the background and disconnect/leave the terminal, then background it or run it in a screen session instead.\npaster serve --reload development.ini &\n\n"
] | [
2
] | [] | [] | [
"apache",
"paster",
"pylons",
"python"
] | stackoverflow_0005190012_apache_paster_pylons_python.txt |
Q:
python paramiko Issue while closing the connection
I have just been trying ssh connection with paramiko.
Everything looks fine, but in the final step, when calling the close() method to disconnect the client.
Here is my script:
#!/usr/bin/python
import paramiko
import os
ssh = paramiko.SSHClient()
private_key = ... | python paramiko Issue while closing the connection | I have just been trying ssh connection with paramiko.
Everything looks fine, but in the final step, when calling the close() method to disconnect the client.
Here is my script:
#!/usr/bin/python
import paramiko
import os
ssh = paramiko.SSHClient()
private_key = os.path.expanduser('~/.ssh/id_dsa')
mkey = paramiko.DSSK... | [
"TL;DR: You are not calling the function. Do so with ssh.close() instead of ssh.close\nssh.close is a reference to that function. It tells you about the function, it does not call the function. Here is an example:\ndef a():\n return 6\n\na\n> <function a at 0x108f71aa0>\na()\n> 6\n\n"
] | [
2
] | [] | [] | [
"paramiko",
"python",
"ssh"
] | stackoverflow_0005193886_paramiko_python_ssh.txt |
Q:
Data embedding in a binary image using python
I'm new to python and I'm attempting to improve on an existing method of embedding data in a binary image with minimal visual distortion. The current method that I am trying to implement needs to have a 3x3 moving window that centers on each pixel and analyses the smoo... | Data embedding in a binary image using python | I'm new to python and I'm attempting to improve on an existing method of embedding data in a binary image with minimal visual distortion. The current method that I am trying to implement needs to have a 3x3 moving window that centers on each pixel and analyses the smoothness of the area within the window and the amount... | [
"You can check Hachoir project. It's a set of python library / tools to dissect files, even if you don't know the format.\nIn your case, you might be interested about one of their example in hachoir-tools : \nhttps://bitbucket.org/haypo/hachoir/src/2a6cad1599c6/hachoir-tools/steganography.py\nThey demonstrate how y... | [
5
] | [] | [] | [
"python",
"steganography"
] | stackoverflow_0005193778_python_steganography.txt |
Q:
Including python and other files
All of the python I've written so far have been fine on my own computer, but now I'd like to send some programs to friends to have them test certain features. Suppose I wrote an application in python with wxpython. Assuming people I send code to will not have either installed, what... | Including python and other files | All of the python I've written so far have been fine on my own computer, but now I'd like to send some programs to friends to have them test certain features. Suppose I wrote an application in python with wxpython. Assuming people I send code to will not have either installed, what is the best way to include both pytho... | [
"You can create a bundle using py2exe and installer using NSIS and ship it as executable so that your friend will get the complete working executable. But mind you, this will increase the size of the file enormously and I have often found it easier to ask them to install via README.txt files.\n",
"There are lots ... | [
1,
0
] | [] | [] | [
"python",
"wxpython"
] | stackoverflow_0005189355_python_wxpython.txt |
Q:
very basic python GUI program help
So I'm working on a pretty basic program in which one of three "doors" is randomly selected. This choice is compared with the user's choice and the user wins if his choice is the same as the randomly selected one.
So basically, I want to re-set the text in the GUI based on whe... | very basic python GUI program help | So I'm working on a pretty basic program in which one of three "doors" is randomly selected. This choice is compared with the user's choice and the user wins if his choice is the same as the randomly selected one.
So basically, I want to re-set the text in the GUI based on whether the user is correct or not. There ... | [
"I don't whether this is a complete fix, but you need to replace this:\nlabel = Text(Point(5,9), \"hello\").draw(win)\n\nwith this:\nlabel = Text(Point(5,9), \"hello\")\nlabel.draw(win)\n\nIn your version, the Text object is created and drawn, but it's the return value of the draw function that gets assigned to lab... | [
2,
0
] | [] | [] | [
"python",
"user_interface"
] | stackoverflow_0005195068_python_user_interface.txt |
Q:
Making Django queries with localized dates
In my form I have a DateField called booking_date that is rendered with the AdminDateWidget. The contents of the booking_date field needs to be internationalized. The problem appears when I want to use the value of the field in something like this:
booking = Booking.objec... | Making Django queries with localized dates | In my form I have a DateField called booking_date that is rendered with the AdminDateWidget. The contents of the booking_date field needs to be internationalized. The problem appears when I want to use the value of the field in something like this:
booking = Booking.objects.get(booking_number='BN34D', booking_date='201... | [
"You should parse it first with a localized version of the strftime format.\nfrom datetime import datetime\nd = datetime.strptime('...')\nbooking.objects.get(..., booking_date=d.date())\n\nUse these formats in strptime:\nhttp://linux.die.net/man/3/strftime\nYou shouldn't rely on passing directly from the user into ... | [
4,
1,
1
] | [] | [] | [
"date",
"django",
"django_models",
"internationalization",
"python"
] | stackoverflow_0005072190_date_django_django_models_internationalization_python.txt |
Q:
SQLAlchemy Connection Pooling Problems - Postgres on Windows
I'm using SQLAlchemy 0.6.6 against a Postgres 8.3 DB on Windows 7 an PY 2.6. I am leaving the defaults for configuring pooling when I create my engine, which is pool_size=5, max_overflow=10.
For some reason, the connections keep piling up and I intermit... | SQLAlchemy Connection Pooling Problems - Postgres on Windows | I'm using SQLAlchemy 0.6.6 against a Postgres 8.3 DB on Windows 7 an PY 2.6. I am leaving the defaults for configuring pooling when I create my engine, which is pool_size=5, max_overflow=10.
For some reason, the connections keep piling up and I intermittently get "Too many clients" from PG. I am positive that connect... | [
"Turns out there was ScopedSession being used outside the normal application usage and the close wasn't in a finally. \n"
] | [
0
] | [] | [] | [
"cherrypy",
"connection_pooling",
"postgresql",
"python",
"sqlalchemy"
] | stackoverflow_0005185438_cherrypy_connection_pooling_postgresql_python_sqlalchemy.txt |
Q:
Iterate through different permutations of 4 functions in Python
OK I am using different taggers to tag a text. Default, unigram, bigram and trigram.
I have to check which combination of three of those four taggers is the most accurate.
To do that i have to loop through all the possible combinations which i do like... | Iterate through different permutations of 4 functions in Python | OK I am using different taggers to tag a text. Default, unigram, bigram and trigram.
I have to check which combination of three of those four taggers is the most accurate.
To do that i have to loop through all the possible combinations which i do like this:
permutaties = list(itertools.permutations(['default_tagger','u... | [
"Not shure if I understood what you need, but you can use the methods you want to call themselves instead of strings - sou your code could become soemthing like:\npermutaties = itertools.permutations([nltk.UnigramTagger, nltk.BigramTagger, nltk.TrigramTagger, nltk.DefaultTagger],3)\nresultaten = [] \nfor element in... | [
1,
0,
0
] | [] | [] | [
"nltk",
"python"
] | stackoverflow_0005194686_nltk_python.txt |
Q:
Using .aggregate() on a value introduced using .extra(select={...}) in a Django Query?
I'm trying to get the count of the number of times a player played each week like this:
player.game_objects.extra(
select={'week': 'WEEK(`games_game`.`date`)'}
).aggregate(count=Count('week'))
But Django complains that
Fiel... | Using .aggregate() on a value introduced using .extra(select={...}) in a Django Query? | I'm trying to get the count of the number of times a player played each week like this:
player.game_objects.extra(
select={'week': 'WEEK(`games_game`.`date`)'}
).aggregate(count=Count('week'))
But Django complains that
FieldError: Cannot resolve keyword 'week' into field. Choices are: <lists model fields>
I can d... | [
"You could use a custom aggregate function to produce your query:\nWEEK_FUNC = 'STRFTIME(\"%%%%W\", %s)' # use 'WEEK(%s)' for mysql\n\nclass WeekCountAggregate(models.sql.aggregates.Aggregate):\n is_ordinal = True\n sql_function = 'WEEK' # unused\n sql_template = \"COUNT(%s)\" % (WEEK_FUNC.replace('%%', '%... | [
15,
4
] | [] | [] | [
"django",
"django_aggregation",
"django_queryset",
"mysql",
"python"
] | stackoverflow_0004567543_django_django_aggregation_django_queryset_mysql_python.txt |
Q:
Why is python's subprocess.call implemented like this?
The subprocess module has the convenience function call, which is implemented like this in both 2.6 and 3.1:
def call(*popenargs, **kwargs):
return Popen(*popenargs, **kwargs).wait()
The documentation for this function carries a red warning, reading:
War... | Why is python's subprocess.call implemented like this? | The subprocess module has the convenience function call, which is implemented like this in both 2.6 and 3.1:
def call(*popenargs, **kwargs):
return Popen(*popenargs, **kwargs).wait()
The documentation for this function carries a red warning, reading:
Warning: Like Popen.wait(), this will deadlock when using stdou... | [
"I spent some time looking through PEP-324, which introduced the subprocess module, trying to figure out the design decisions involved, but I think the answer is actually very simple:\nThere's no reason to pass stdout=PIPE or stderr=PIPE to subprocess.call, so the fact that it can deadlock is irrelevant.\nThe only ... | [
8,
2
] | [] | [] | [
"python",
"subprocess"
] | stackoverflow_0005195122_python_subprocess.txt |
Q:
how to install multiple python versions on snow leopard?
whats is the current best practice for installing multiple versions of python on snow leopard?
have setup python 2.7.1 via Homebrew, very easy process, all great.
but now I need to setup python 2.5 to develop an appengine project.. Initially created a new ... | how to install multiple python versions on snow leopard? | whats is the current best practice for installing multiple versions of python on snow leopard?
have setup python 2.7.1 via Homebrew, very easy process, all great.
but now I need to setup python 2.5 to develop an appengine project.. Initially created a new virtualenv against system python2.5 .. but finding I have all ... | [
"Snow leopard already contains python 2.5 and python 2.6, no issues there.\nIf you require obscure modifications to the python installations, just compile your own, and put it in some place where it won't conflict with the system python. (I suggest /opt/your-pythonx.y).\nAs an aside, check: \"man python\" on mac to... | [
2,
0
] | [] | [] | [
"homebrew",
"osx_snow_leopard",
"python",
"virtualenv"
] | stackoverflow_0005194343_homebrew_osx_snow_leopard_python_virtualenv.txt |
Q:
User defined input csv file
I some lines of code that read a csv file in a certain format. What I'd like now (and couldn't figure out a solution for) is that the file name stops being stale and becomes an actual user input when calling the python program. Now I have a static file name in the code, eg:
reader = cs... | User defined input csv file | I some lines of code that read a csv file in a certain format. What I'd like now (and couldn't figure out a solution for) is that the file name stops being stale and becomes an actual user input when calling the python program. Now I have a static file name in the code, eg:
reader = csv.reader(open("file.csv", "rb"))
... | [
"The simplest way is to write your script like this:\nimport sys\nreader = csv.reader(open(sys.argv[1], \"rb\"))\n\nand then run it like this:\npython testfile.py file.csv\n\nYou should put in some error checking, eg:\nif len(sys.argv) < 2:\n print \"Usage...\"\n sys.exit(1)\n\nFor more power, use the bult in... | [
5,
2,
1,
0,
0
] | [] | [] | [
"csv",
"python"
] | stackoverflow_0005195295_csv_python.txt |
Q:
What types of languages allow programmatic creation of variable names?
This question comes purely out of intellectual curiosity.
Having browsed the Python section relatively often, I've seen a number of questions similar to this, where someone is asking for a programmatic way to define global variables. Some of t... | What types of languages allow programmatic creation of variable names? | This question comes purely out of intellectual curiosity.
Having browsed the Python section relatively often, I've seen a number of questions similar to this, where someone is asking for a programmatic way to define global variables. Some of them are aware of the pitfalls of exec, others aren't.
However, I've recentl... | [
"It's really just a question of how much syntactic sugar is there. In any language worth its salt, you can use a map or dictionary data structure to create variable names (keys) at runtime with some value. Some languages may more transparently integrate that with ordinary variable identifiers than others.\n",
"(... | [
3,
3,
2,
1
] | [] | [] | [
"python",
"stata",
"stata_macros",
"variable_assignment"
] | stackoverflow_0005189771_python_stata_stata_macros_variable_assignment.txt |
Q:
Object has no attribute
Please Help on my code with threads. it goes like
class MyThread(threading.Thread): # Create a class representing a thread of control
def __init__(self,target):
print 'thread created'
self.target = target
threading.Thread.__init__ ( self )
... | Object has no attribute | Please Help on my code with threads. it goes like
class MyThread(threading.Thread): # Create a class representing a thread of control
def __init__(self,target):
print 'thread created'
self.target = target
threading.Thread.__init__ ( self )
def run (self):
... | [
"You have two init functions defined. The second definition (which doesn't define target) overrides the first.\n",
"Uhm... you are overriding your own init method, and the override doesn't assign the self.target variable.\n"
] | [
4,
0
] | [] | [] | [
"multithreading",
"python"
] | stackoverflow_0005196543_multithreading_python.txt |
Q:
Installing a python service with --username xxx --password xxxx
I have a python service installed and working on a local machine but the service I am writing needs to access another machine. It needs to be associated with a username and password. When I try myservice.py --username xxx --password yyy --startup aut... | Installing a python service with --username xxx --password xxxx | I have a python service installed and working on a local machine but the service I am writing needs to access another machine. It needs to be associated with a username and password. When I try myservice.py --username xxx --password yyy --startup auto install I get an error message
Installing service apdm_upLoader
Er... | [
"It turns out, if you don't have a domain then you should use .\\username. I discovered this by going to my computer / manage / services. First I had to do a simple install of the process which works fine. Then in the services pane I double clicked my python process and there was a really nice gui to do all the ... | [
0
] | [] | [] | [
"installation",
"python",
"service"
] | stackoverflow_0005195883_installation_python_service.txt |
Q:
Tools (and applications) for django developer
I'm a beginner django developer. And often, when looking for solutions or reading articles on web I find lots of useful django applications, libraries, etc... But I've never met a comprehensive list.
So I ask everyone to share your list of django related stuff you use ... | Tools (and applications) for django developer | I'm a beginner django developer. And often, when looking for solutions or reading articles on web I find lots of useful django applications, libraries, etc... But I've never met a comprehensive list.
So I ask everyone to share your list of django related stuff you use in your projects. So far I've learnt:
South -- int... | [
"One awesome tool is the PyCharm program that supports Django. It lets you do things like runserver and syncdb from within the app so you don't need to keep switching back and forth to the terminal. Google PyCharm and you should find it. \n",
"I find django-extensions essential to my development process. The sql... | [
0,
0,
0
] | [] | [] | [
"django",
"python"
] | stackoverflow_0005191788_django_python.txt |
Q:
How do I grep for words coming from a file in files listed in a file?
Searching a single file for a word is easy:
grep stuff file.txt
But I have many files, each is a line in files.txt, and many words I want to find, each is a line in words.txt. The output should be a file with each line a => b with a being the ... | How do I grep for words coming from a file in files listed in a file? | Searching a single file for a word is easy:
grep stuff file.txt
But I have many files, each is a line in files.txt, and many words I want to find, each is a line in words.txt. The output should be a file with each line a => b with a being the line number in words.txt, b being the line number in files.txt.
I need to r... | [
"First, learn to specify the files of interest. In one directory or more than one directory? The Unix find utility will do that. \nAt the Bash prompt:\n$ cd [the root directory where your files are]\n$ find . -name \"*.txt\"\n\nYou did not say, but assumably the files are describable with \"star dot something\" the... | [
1,
1,
1,
0,
0,
0,
0,
0
] | [] | [] | [
"macos",
"perl",
"python",
"shell"
] | stackoverflow_0005190507_macos_perl_python_shell.txt |
Q:
Closing files in Python
In this discussion about the easiest way to run a process and discard its output, I suggested the following code:
with open('/dev/null', 'w') as dev_null:
subprocess.call(['command'], stdout=dev_null, stderr=dev_null)
Another developer suggested this version:
subprocess.call(['command'... | Closing files in Python | In this discussion about the easiest way to run a process and discard its output, I suggested the following code:
with open('/dev/null', 'w') as dev_null:
subprocess.call(['command'], stdout=dev_null, stderr=dev_null)
Another developer suggested this version:
subprocess.call(['command'], stdout=open('/dev/null', '... | [
"You are correct, refcouting is not guaranteed. In fact, only CPython (which is the main implementation, yes, but not even remotely the only one) provdies refcounting. In case CPython ever changes that implementation detail (unlikely, yes, but possible), or your code is ever run on an alternate implementation, or y... | [
10,
1,
1
] | [] | [] | [
"file_io",
"garbage_collection",
"python",
"with_statement"
] | stackoverflow_0005196724_file_io_garbage_collection_python_with_statement.txt |
Q:
Python program getting stuck
I am new to Python and I am writing a program just for fun. My program consists of three .py files (let's say a.py, b.py, c.py). a will either call on the functions within either b or c, depending on the user's option. After it completes its first round it asks if the user would like t... | Python program getting stuck | I am new to Python and I am writing a program just for fun. My program consists of three .py files (let's say a.py, b.py, c.py). a will either call on the functions within either b or c, depending on the user's option. After it completes its first round it asks if the user would like to continue or simply exit the prog... | [
"You need to restructure your code to only create the root window once, and only call mainloop once. Tkinter is not designed to be able to create and destroy the root multiple times in a single process. \nIf you need multiple windows, create additional windows with the Toplevel command. \n"
] | [
2
] | [] | [] | [
"python",
"tkinter"
] | stackoverflow_0005196509_python_tkinter.txt |
Q:
getting dogtail example script to run on Ubuntu 10.04
I recently installed Dogtail, an open source GUI testing tool and automation framework. I downloaded the example script (https://fedorahosted.org/dogtail/browser/examples/gedit-test-utf8-tree-api.py?format=txt) to my computer, but am having trouble getting it w... | getting dogtail example script to run on Ubuntu 10.04 | I recently installed Dogtail, an open source GUI testing tool and automation framework. I downloaded the example script (https://fedorahosted.org/dogtail/browser/examples/gedit-test-utf8-tree-api.py?format=txt) to my computer, but am having trouble getting it work. When I invoke it, I get a message saying:
corey@corey-... | [
"Don't name the file in /home/joe/Desktop/exercise dogtail:\n File \"/home/joe/Desktop/exercise/dogtail.py\", line 6, in <module>\n from dogtail import tree\n\nPython is importing your dogtail.py instead of the package located at /usr/share/python-support/python-dogtail/dogtail.\nTo test this theory, you can op... | [
3,
1,
1
] | [] | [] | [
"python",
"ubuntu"
] | stackoverflow_0003844178_python_ubuntu.txt |
Q:
Error checking in python
After struggling with data download with ill tempered CSV fields. How could use try/Except format.
LL = [(XXX,YYY,ZZZ),] or [[XXX,YYY,ZZZ],]
if above, how do i do below?
try:
IF XXX or YYY or ZZZ or AAA == 'N/A',
(dont process data...skip to except and pass)
except:
pass
sta... | Error checking in python | After struggling with data download with ill tempered CSV fields. How could use try/Except format.
LL = [(XXX,YYY,ZZZ),] or [[XXX,YYY,ZZZ],]
if above, how do i do below?
try:
IF XXX or YYY or ZZZ or AAA == 'N/A',
(dont process data...skip to except and pass)
except:
pass
staeted here:
Remove/Replace Err... | [
"UPDATED\nI suppose like that\ntry: \n if \"N/A\" in [XXX,YYY,ZZZ,AAA]\n raise Exception()\nexcept:\n pass \n\n",
"for data in LL:\n try:\n if \"N/A\" in data:\n continue\n else:\n x, y, z = data\n # Process data...\n except Exception:\n continue\n\n",
"Note ... | [
1,
1,
1
] | [] | [] | [
"error_handling",
"python"
] | stackoverflow_0005197702_error_handling_python.txt |
Q:
calling a cdef in a cdef class
is their any way to make this work, without sacrificing the cdef in cdef caller? (no use of cpdef either)
from array import *
from numpy import *
cdef class Agents:
cdef public caller(self):
print "caller"
A[1].called()
cdef called(self):
print "calle... | calling a cdef in a cdef class | is their any way to make this work, without sacrificing the cdef in cdef caller? (no use of cpdef either)
from array import *
from numpy import *
cdef class Agents:
cdef public caller(self):
print "caller"
A[1].called()
cdef called(self):
print "called"
A = [Agents() for i in range(2)... | [
"For Cython A[1] will be a python object. If you want to be able to still use cdef, use automatic cast in your caller :\ncdef public caller(self):\n cdef Agents agent\n print \"caller\"\n agent = A[1]\n agent.called()\n\nYou can check with the -a mode in cython to know if you are using Python or C for e... | [
4
] | [] | [] | [
"cython",
"python"
] | stackoverflow_0002444000_cython_python.txt |
Q:
Tree Implementation in Python
I found two similar questions(infact same question) for implementing tree in python. Can anyone point me to good references to implement trees. The link given in previous answers is not working.Thanks!
A:
Try having a look at the samples provided by MIT Open CourseWare. The Introduc... | Tree Implementation in Python | I found two similar questions(infact same question) for implementing tree in python. Can anyone point me to good references to implement trees. The link given in previous answers is not working.Thanks!
| [
"Try having a look at the samples provided by MIT Open CourseWare. The Introduction to Algorithms Lecture Notes may prove helpful.\n"
] | [
0
] | [] | [] | [
"python"
] | stackoverflow_0005196786_python.txt |
Q:
Content of Django flatpages not stored
I have added the flatpages package and tried to add a flatpage in the admin interface. The title and URL are added, but not the content of the page. The content of a flatpage is edited in the YAHOO.widget.Editor. Does anyone know why the content of a flatpage isn't stored and... | Content of Django flatpages not stored | I have added the flatpages package and tried to add a flatpage in the admin interface. The title and URL are added, but not the content of the page. The content of a flatpage is edited in the YAHOO.widget.Editor. Does anyone know why the content of a flatpage isn't stored and know how I can solve this problem?
| [
"Django developer James Bennet added TinyMCE to flatpages in his book Practical Django Projects. His code is available on BitBucket: https://bitbucket.org/ubernostrum/practical-django-projects/src/79e75633cbd4/cms/\nI've used his example in a project using flatpages before, and it worked great. Give it a try.\n"
] | [
0
] | [] | [] | [
"django",
"django_flatpages",
"python",
"wysiwyg"
] | stackoverflow_0005194493_django_django_flatpages_python_wysiwyg.txt |
Q:
No module named index
I am getting the error
Exception Value:No module named index. i have __init__.py in DjangoPhoneBook and phonebook folder. I'm newbie to django and i m following the tutorial on djangoproject website. I have googled this error but not getting any solutions.
What is cause and solution to th... | No module named index | I am getting the error
Exception Value:No module named index. i have __init__.py in DjangoPhoneBook and phonebook folder. I'm newbie to django and i m following the tutorial on djangoproject website. I have googled this error but not getting any solutions.
What is cause and solution to this problem??
Environment:
... | [
"Remove the include from your first line. include is the syntax for adding a separate url conf, so python is looking for a module called index. \nChange it to the full python dot path to your view function.\nurlpatterns = patterns('',\n (r'^Book/$', 'path.to.my.views.index'), # <-- and add a comma here\n (r'^... | [
11
] | [] | [] | [
"django",
"python"
] | stackoverflow_0005198336_django_python.txt |
Q:
getting pixels value in a checkerboard pattern in python
I have a black and white image which every pixel values are loaded as a nested list with numpy (2948x1536). What i need to do is to grab the pixels from that list in a checkerboard pattern. So I need to extract pixels like this :
0 1 0 1 0 1 0 1
1 0 1 0 1 0 ... | getting pixels value in a checkerboard pattern in python | I have a black and white image which every pixel values are loaded as a nested list with numpy (2948x1536). What i need to do is to grab the pixels from that list in a checkerboard pattern. So I need to extract pixels like this :
0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0
0 1 0 1 0 1 0 1
....
How would this be done ? Is this a go... | [
"Let's use smaller dimensions so the result is easier to see:\nimport numpy as np\n# w=2948\n# h=1536\nw=6\nh=4\narr=np.arange(w*h).reshape(w,h)\nprint(arr)\nprint(arr.shape)\n# [[ 0 1 2 3]\n# [ 4 5 6 7]\n# [ 8 9 10 11]\n# [12 13 14 15]\n# [16 17 18 19]\n# [20 21 22 23]]\n# (6, 4)\n\nWe can construct a ... | [
2,
0
] | [] | [] | [
"image_processing",
"python"
] | stackoverflow_0005198116_image_processing_python.txt |
Q:
Defining attributes for objects/entities in python/google app engine
I've seen repeated examples like this:
from google.appengine.ext import db
import datetime
class Book(db.Expando):
pass
obj = Book()
obj.title = 'The Grapes of Wrath'
obj.author = 'John Steinbeck'
obj.copyright_year = 1939
obj.author_birthd... | Defining attributes for objects/entities in python/google app engine | I've seen repeated examples like this:
from google.appengine.ext import db
import datetime
class Book(db.Expando):
pass
obj = Book()
obj.title = 'The Grapes of Wrath'
obj.author = 'John Steinbeck'
obj.copyright_year = 1939
obj.author_birthdate = datetime.date(1902, 2, 27)
obj.put()
It's the first time I've come... | [
"This is documented here. The snippet provided is valid, although it's not clear why the class is completely empty (might be for illustrational purposes). I suppose the main question is when to use Expando Model? \nImagine a site collecting orders for all kinds of goods possible. One customer might want to order a ... | [
3,
2
] | [] | [] | [
"class_design",
"google_app_engine",
"python"
] | stackoverflow_0005198228_class_design_google_app_engine_python.txt |
Q:
save text file and display its content on the browser
If the following script.py writes "some text here" to output.txt file, my URL will be http://my_name/script.py. My question is, how can I read the output.txt as soon as (right after) the following function creates it, so that my URL reads like http://my_name/ou... | save text file and display its content on the browser | If the following script.py writes "some text here" to output.txt file, my URL will be http://my_name/script.py. My question is, how can I read the output.txt as soon as (right after) the following function creates it, so that my URL reads like http://my_name/output.txt.
Many thanks in advance.
#------ script.py -------... | [
"try webbrowser lib.\nimport webbrowser\n\nmyurl = \"file:///mydir/output.txt\"\nwebbrowser.open(myurl) \n\nHowever:\n\nNote that on some platforms, trying to\n open a filename using this function,\n may work and start the operating\n system’s associated program.\n\nThat is: your file will probably be open in yo... | [
0,
0
] | [] | [] | [
"python"
] | stackoverflow_0005197466_python.txt |
Q:
Multiple versions of mercurial installed - how to set one to be the default
I have two versions of mercurial installed on my Mac OS 10.6.6 and I want to use one of them by default.
I installed mercurial with a binary from here. I have been running mercurial from the terminal with the hg command as it is installed ... | Multiple versions of mercurial installed - how to set one to be the default | I have two versions of mercurial installed on my Mac OS 10.6.6 and I want to use one of them by default.
I installed mercurial with a binary from here. I have been running mercurial from the terminal with the hg command as it is installed in
/Library/Python/2.6/site-packages
even though I mostly use Python 2.7.
As a s... | [
"Never mind - in the last few minutes I looked all over for the hg command.\nIt found them in\n/usr/local/bin/hg\n\nwhich was put there by the binary downloaded from the website some time ago, and\n/Library/Frameworks/Python.framework/Versions/2.7/bin/hg\n\nwhich was created today when I installed with pip.\nSo I j... | [
1,
1
] | [] | [] | [
"macos",
"mercurial",
"python"
] | stackoverflow_0005199039_macos_mercurial_python.txt |
Q:
Custom widget in ScrollArea is being squashed!
I have a qscrollarea and within that a qgridlayout. In the grid layout I create a number of custom widgets (for simplicity these widgets are simply a groupbox and a label) and add one on each row.
Instead of displaying the vertical scrollbar, the custom widgets are a... | Custom widget in ScrollArea is being squashed! | I have a qscrollarea and within that a qgridlayout. In the grid layout I create a number of custom widgets (for simplicity these widgets are simply a groupbox and a label) and add one on each row.
Instead of displaying the vertical scrollbar, the custom widgets are all compressed to fit the size of the scrollarea.
I a... | [
"QScrollArea only accepts one widget. No layouts.\nAdd the layout and widgets into a plain QWidget, and then add that to the QScrollArea with setWidget() \n"
] | [
2
] | [] | [] | [
"pyqt",
"pyqt4",
"python",
"qt",
"qwidget"
] | stackoverflow_0005164117_pyqt_pyqt4_python_qt_qwidget.txt |
Q:
Writing data from python list?
I have three list A,B and C. I want to write the contents of the list to the file like this:
A[1]
B[1]
C[1]
A[2]
B[2]
C[2]
.
.
.
A:
Take a look at using zip. With zip you get a list of tuples, the tuples being the ith item of each list. As a bonus, the list of tuples is truncated... | Writing data from python list? | I have three list A,B and C. I want to write the contents of the list to the file like this:
A[1]
B[1]
C[1]
A[2]
B[2]
C[2]
.
.
.
| [
"Take a look at using zip. With zip you get a list of tuples, the tuples being the ith item of each list. As a bonus, the list of tuples is truncated to the shortest list of the three:\nmyComboList = zip(A, B, C)\n\nThen you can always write the things in the order you'd like them without fear that one list may b... | [
3,
2,
1,
1
] | [] | [] | [
"python"
] | stackoverflow_0005198117_python.txt |
Q:
numpy structured arrays: help understanding output
I am trying to learn how to use numpy's structured arrays. Specifically, I was trying to add information to more than one field at a time. I tried:
import numpy as np
numrec = np.zeros(8, dtype=[('col0', 'int16'), ('col1', 'int16'),
('... | numpy structured arrays: help understanding output | I am trying to learn how to use numpy's structured arrays. Specifically, I was trying to add information to more than one field at a time. I tried:
import numpy as np
numrec = np.zeros(8, dtype=[('col0', 'int16'), ('col1', 'int16'),
('col2', 'int16'), ('col3', 'int16')])
numrec[['col1','co... | [
"You are setting values on a temporary.\nnumrec[[\"col1\", \"col2\"]]\n\nreturns a copy of the array. You can see this by the OWNDATA flag.\n>>> numrec[[\"col1\", \"col2\"]].flags[\"OWNDATA\"]\nTrue\n\nWhen you index a numpy array with a list, numpy returns a copy of the data. It has to be a copy, because, in gen... | [
9
] | [] | [] | [
"numpy",
"python",
"recarray"
] | stackoverflow_0005199056_numpy_python_recarray.txt |
Q:
list of blog engines written in python
Can I get a list of popular blog engines written in python?
google didn't help much!
A:
How about this list:
http://wiki.python.org/moin/PythonBlogSoftware
Although I can't speak to how popular any of these are.
also among the popular static site generators written in pytho... | list of blog engines written in python | Can I get a list of popular blog engines written in python?
google didn't help much!
| [
"How about this list:\nhttp://wiki.python.org/moin/PythonBlogSoftware\nAlthough I can't speak to how popular any of these are.\nalso among the popular static site generators written in python that are missing from the above list.\n\nHyde: http://ringce.com/hyde (now being developed at https://github.com/hyde/hyde)\... | [
21
] | [] | [] | [
"blog_engine",
"python"
] | stackoverflow_0005199432_blog_engine_python.txt |
Q:
What is Perl equivalent of Python's type() function
I can do this in Python:
>>> type(1)
<class 'int'>
What's the Perl equivalent?
A:
Perl does not make a hard distinction between strings and numbers the way that Python or Ruby do. In Perl, the use of operators determines how the variable will be interpreted.
... | What is Perl equivalent of Python's type() function | I can do this in Python:
>>> type(1)
<class 'int'>
What's the Perl equivalent?
| [
"Perl does not make a hard distinction between strings and numbers the way that Python or Ruby do. In Perl, the use of operators determines how the variable will be interpreted.\nIn Python, when you write 1 + 2, Python checks the type of each argument, sees that they are numbers, and then performs the addition (3)... | [
14,
6,
4,
3,
1
] | [] | [] | [
"perl",
"python"
] | stackoverflow_0005180746_perl_python.txt |
Q:
Passing inherited object to a WCF service using JSON
I have two classes that I have listed below
public Class Vehicle
{
int wheels { get ; set}
}
public Class Car:Vehicle
{
int topspeed { get; set ;}
}
//This is the container class
public Class Message
{
string ConatinerName { get; set;}
Vehicle Con... | Passing inherited object to a WCF service using JSON | I have two classes that I have listed below
public Class Vehicle
{
int wheels { get ; set}
}
public Class Car:Vehicle
{
int topspeed { get; set ;}
}
//This is the container class
public Class Message
{
string ConatinerName { get; set;}
Vehicle Container;
}
I have defined a service contract which looks l... | [
"I have a similar problem using Python to call a WCF with JSON. Remarkably, what fixed it for me was ensuring that the __type key came first in the post request.\nFor example, json.dumps(data, sort_keys=True) would return something like this. The WCF service didn't like that because __type was not first in the Co... | [
4,
0
] | [] | [] | [
"c#",
"json",
"python",
"soap",
"wcf"
] | stackoverflow_0005190381_c#_json_python_soap_wcf.txt |
Q:
replace empty string(s) in tuple
Is there an easy way (hopefully a one liner) to replace '' with something like '-'?
Many thanks.
tup = (1,2,'ABC','','','','text')
A:
How about the following?
tuple('-' if x == '' else x for x in tup)
As Felix Kling comments, tuples are immutable, so the best you can do is to r... | replace empty string(s) in tuple | Is there an easy way (hopefully a one liner) to replace '' with something like '-'?
Many thanks.
tup = (1,2,'ABC','','','','text')
| [
"How about the following?\n tuple('-' if x == '' else x for x in tup)\n\nAs Felix Kling comments, tuples are immutable, so the best you can do is to return a new one.\n"
] | [
16
] | [] | [] | [
"python"
] | stackoverflow_0005200154_python.txt |
Q:
Can I use Fabric to perform interactive shell commands?
I`m trying to use fabric to install and deploy a web project during which I need to create a postgresql database and configure a RabbitMQ server. Both these operations are interactive and requires input from the user for creating a database, adding a user, se... | Can I use Fabric to perform interactive shell commands? | I`m trying to use fabric to install and deploy a web project during which I need to create a postgresql database and configure a RabbitMQ server. Both these operations are interactive and requires input from the user for creating a database, adding a user, setting password etc ( at least to my knowledge ).
Can I use a ... | [
"This is in Fabric 1.0. I've tried it and it works for me.\n\nOlder versions of Fabric (and similar high level SSH libraries) run remote programs in limbo, unable to be touched from the local end. This is problematic when you have a serious need to enter passwords or otherwise interact with the remote program.\nFab... | [
10
] | [] | [] | [
"fabric",
"interactive",
"python",
"shell"
] | stackoverflow_0005182857_fabric_interactive_python_shell.txt |
Q:
converting an uploaded csv to python list
I have a two-column csv which I have uploaded via an HTML page to be operated on by a python cgi script. Looking at the file on the server side, it looks to be a long string i.e for a file called test.csv with the contents.
col1, col2
x,y
has become
('upfile', '... | converting an uploaded csv to python list | I have a two-column csv which I have uploaded via an HTML page to be operated on by a python cgi script. Looking at the file on the server side, it looks to be a long string i.e for a file called test.csv with the contents.
col1, col2
x,y
has become
('upfile', 'test.csv', 'col1,col2'\t\r\nx,y')
Col1 contai... | [
"If you're using the cgi module in python, you should be able to do something like:\nform = cgi.FieldStorage()\nthefile = form['upfile']\n\nreader = csv.reader(thefile.file)\nheader = reader.next() # list of column names\nfor row in reader:\n # row is a list of fields\n process_row(row)\n\nSee, for example, c... | [
4,
3,
2
] | [
"The easy solution is rows = [row.split('\\t') for r in csv_string.split('\\r\\n')]. It's only error proned if you have users from different platforms submit data. They might submit comas or tabs and their line breaks could be \\n, \\r\\n, \\r, or ^M. The easiest solution is to use regular expressions. Book mark th... | [
-2
] | [
"cgi",
"list",
"python"
] | stackoverflow_0005200435_cgi_list_python.txt |
Q:
Basic python cgi security question: Storing sensitive information in another directory
So I have been developing my first website. I have a cgi script that allows users to sign up for e-mail updates. However, I don't trust the security of cgi-bin with the api-key I am using to sign people up to a mailing list. So ... | Basic python cgi security question: Storing sensitive information in another directory | So I have been developing my first website. I have a cgi script that allows users to sign up for e-mail updates. However, I don't trust the security of cgi-bin with the api-key I am using to sign people up to a mailing list. So I put the api-key in another folder in home with chmod 711 on the directory (as opposed to 7... | [
"This isn't a Python question (the fact that you're using Python is totally incidental), but the answer is: yeah, it's a good idea to have your sensitive data in a place where your Web server can't, even if somewhat misconfigured, send it to an attacker. So outside of whatever directory hierarchy your Web documents... | [
0,
0
] | [] | [] | [
"cgi",
"python",
"security"
] | stackoverflow_0005200635_cgi_python_security.txt |
Q:
Why does Python use built-ins instead of object methods (like ruby, etc)?
Possible Duplicate:
Why does python use 'magic methods'?
Just want to clarify, this is NOT a python vs ruby. I've been a user of python for ~1 year. I like it a lot except for some of the funky built-ins vs having methods. Like why do you ... | Why does Python use built-ins instead of object methods (like ruby, etc)? |
Possible Duplicate:
Why does python use 'magic methods'?
Just want to clarify, this is NOT a python vs ruby. I've been a user of python for ~1 year. I like it a lot except for some of the funky built-ins vs having methods. Like why do you have to do len(listA) instead of listA.length() or listA.size() like ruby or J... | [
"Mainly due to history. Python's ancestor was a teaching language called ABC, which was, I gather, somewhat BASIC-like.\nPersonally, I think it's kind of nice to know that I can always get the length of something with len(thing) without having to know what the implementer of a particular type called their equivalen... | [
1
] | [] | [] | [
"python",
"ruby"
] | stackoverflow_0005200757_python_ruby.txt |
Q:
Output unformated?
I am newbie in Python. Was doing an exercise in LearnPythonTheHardWay by Mr. Zed Shaw.
I have been stuck with this problem
here is the code:
age=input("How old are you?");
height=input("How tall are you?");
weight=input("How much do you weight?");
print ("age = %r height = %r weight = %r" %(age,... | Output unformated? | I am newbie in Python. Was doing an exercise in LearnPythonTheHardWay by Mr. Zed Shaw.
I have been stuck with this problem
here is the code:
age=input("How old are you?");
height=input("How tall are you?");
weight=input("How much do you weight?");
print ("age = %r height = %r weight = %r" %(age,height,weight))
And its... | [
"It looks like you are using Python 3. In Python 3, the input() function returns a string which is what you typed at the prompt. In Python 2, the input() function returns an evaluated expression, which in your case if you type a number would be an integer.\nYou have three basic choices:\n\nFind a tutorial that uses... | [
4,
0
] | [] | [] | [
"python"
] | stackoverflow_0005200824_python.txt |
Q:
My py2app app will not open. What's the problem?
I'm writing a simple game with python, pygame and py2app. (I use python 2.6) When I build my game in alias mode, it works fine, but when I build for deployment, the app I get crashes immediately after lunching. Anyone know what's going on?
A:
To provide a more tho... | My py2app app will not open. What's the problem? | I'm writing a simple game with python, pygame and py2app. (I use python 2.6) When I build my game in alias mode, it works fine, but when I build for deployment, the app I get crashes immediately after lunching. Anyone know what's going on?
| [
"To provide a more thorough answer to this whole issue, I'm going to use the aliens.py example.\nWhen built in OS X, you will see quick flash as the game quickly initializes and quits. Opening console reveals an error message similar to \nFatal Python error: (pygame parachute) Segmentation Fault\nJob appears to ha... | [
5
] | [] | [] | [
"py2app",
"pygame",
"python"
] | stackoverflow_0003470377_py2app_pygame_python.txt |
Q:
Error with optimality in Iterative Deepening Depth First Search algorithm
I have implemented a version of Rush Hour (the puzzle board game) in Python as a demonstration of some AI algorithms. The game isn't important, because the AI is relatively independent of its details: I've attempted to implement a version of... | Error with optimality in Iterative Deepening Depth First Search algorithm | I have implemented a version of Rush Hour (the puzzle board game) in Python as a demonstration of some AI algorithms. The game isn't important, because the AI is relatively independent of its details: I've attempted to implement a version of iterative deepening depth first search in Python as follows (note that this co... | [
"I can't test this but I think the problem is this predicate:\nif str(child.state) not in frontier_hash_set and \\\n str(child.state) not in explored:\n\nThe problem is that earlier in this DFS iteration, child.state may have been inserted into the frontier or set of visited states, but with a greater cost.\nS ->... | [
3,
0
] | [] | [] | [
"algorithm",
"artificial_intelligence",
"python",
"search"
] | stackoverflow_0005001014_algorithm_artificial_intelligence_python_search.txt |
Q:
Django values_list returns unicode
I have the following queryset in a view:
cities = Idea.published.values_list('city', flat=True).distinct()
And the following in my corresponding template:
{% for city in cities %}
<li><a href="{% url ideas-by-city city %}">{{ city }}</a></li>
{% endfor %}
The {{ city }} var... | Django values_list returns unicode | I have the following queryset in a view:
cities = Idea.published.values_list('city', flat=True).distinct()
And the following in my corresponding template:
{% for city in cities %}
<li><a href="{% url ideas-by-city city %}">{{ city }}</a></li>
{% endfor %}
The {{ city }} variable prints out as a string on the rend... | [
"You probably want \n\niriencode\n\nas in {{ value|iriencode }}. See the Django builtins docs for more information.\n"
] | [
0
] | [] | [] | [
"django",
"python",
"unicode"
] | stackoverflow_0005200855_django_python_unicode.txt |
Q:
How to display ANSI colors in python script output running on Unix
I have a simple Python script that uses ANSI escape sequences to have colored output on the terminal.
And this works great, but when the output is being used elsewhere (for example in VIM) all the ANSI sequences show up and it makes it really unrea... | How to display ANSI colors in python script output running on Unix | I have a simple Python script that uses ANSI escape sequences to have colored output on the terminal.
And this works great, but when the output is being used elsewhere (for example in VIM) all the ANSI sequences show up and it makes it really unreadable.
For example, to display RED I do something like:
^[[91m Errors:
-... | [
"You can use os.isatty with the stdout file descriptor, which can be retrieved by calling fileno on sys.stdout.\nEdit: It looks like files also have an isatty method; therefore, you can avoid using the os module and just using sys.stdout.isatty().\n",
"Look at this answer it covers exactly what you are asking for... | [
3,
1
] | [] | [] | [
"ansi_escape",
"python",
"terminal"
] | stackoverflow_0005201137_ansi_escape_python_terminal.txt |
Q:
Method to sort a list of lists?
I have a list of lists (can't be tuples since I have to generate it dynamically) and it is structured as a list of lists of one int and one float Like so:
[[1,1.0345],[2,5.098],[3,4.89],[2,5.97]]
I want to get it sorted but I have only managed to get the built in sorting function t... | Method to sort a list of lists? | I have a list of lists (can't be tuples since I have to generate it dynamically) and it is structured as a list of lists of one int and one float Like so:
[[1,1.0345],[2,5.098],[3,4.89],[2,5.97]]
I want to get it sorted but I have only managed to get the built in sorting function to sort it by the first element of the... | [
"Pass the key argument.\nL.sort(key=operator.itemgetter(1))\n\n",
">>> l = [[1,1.0345],[2,5.098],[3,4.89],[2,5.97]]\n>>> l.sort(key=lambda x: x[1])\n>>> l\n[[1, 1.0345], [3, 4.8899999999999997], [2, 5.0979999999999999], [2, 5.9699999999999998]]\n\n",
"How about using they key parameter of sorted...\nsorted_list... | [
21,
13,
3
] | [] | [] | [
"list",
"python",
"sorting"
] | stackoverflow_0005201191_list_python_sorting.txt |
Q:
Apple Automator process csv files and create new files
Is it possible to loop through a set of selected files, process each, and save the output as new files using Apple Automator?
I have a collection of .xls files, and I've gotten Automator to
- Ask for Finder Items
- Open Finder Items
- Convert Format of Excel F... | Apple Automator process csv files and create new files | Is it possible to loop through a set of selected files, process each, and save the output as new files using Apple Automator?
I have a collection of .xls files, and I've gotten Automator to
- Ask for Finder Items
- Open Finder Items
- Convert Format of Excel Files #save each .xls file to a .csv
I've written a python s... | [
"Why do you want this done in the folder of the script? Or do you mean the folder of the files you are getting from the Finder items? In that case just get the path for each file passed into Python.\nWhen you run open('filename','w') you should thus pass in a full pathname. Probably what's happening is you are a... | [
1
] | [] | [] | [
"automator",
"macos",
"python"
] | stackoverflow_0004426444_automator_macos_python.txt |
Q:
Python keeping socket alive?
Hey I'm working on a python project using sockets. Basically I want to loop a connection to a host for user input. Here is what I'm trying:
while True:
sock.connect((host, port))
inputstring = " > "
userInput = raw_input(inputstring)
sock.send(userInput + '\r\n\r\n')
... | Python keeping socket alive? | Hey I'm working on a python project using sockets. Basically I want to loop a connection to a host for user input. Here is what I'm trying:
while True:
sock.connect((host, port))
inputstring = " > "
userInput = raw_input(inputstring)
sock.send(userInput + '\r\n\r\n')
recvdata = sock.recv(socksize)
... | [
"Call connect outside the while loop. You only need to connect once.\n",
"Put the sock.connect outside of your while True.\n",
"You only need to connect to the host once, then you can run your loop. Try:\nsock.connect((host, port))\nwhile True:\n inputstring = \" > \"\n # etc\n\nIf the body of your loop w... | [
2,
1,
0
] | [] | [] | [
"connection",
"loops",
"python",
"sockets",
"tcp"
] | stackoverflow_0005201388_connection_loops_python_sockets_tcp.txt |
Q:
Efficient (both time and space) dictionary database (unique word to uniq id and back)
I'm looking for a solution, which is capable of:
storing arbitrary sized unique words, along with their unique 64 bit unsigned integer identifier and a 32 or 64 bit unsigned int reference count
accessing the data quickly with th... | Efficient (both time and space) dictionary database (unique word to uniq id and back) | I'm looking for a solution, which is capable of:
storing arbitrary sized unique words, along with their unique 64 bit unsigned integer identifier and a 32 or 64 bit unsigned int reference count
accessing the data quickly with these patterns:
for a lookup of a word, give back its uint64 identifier
for a lookup of an i... | [
"You might want to try Redis. It covers most if not all of\nyour requirements. It has good performance for your use case, has atomic \nincrement/decrement for creating reference counts and unique identifiers,\nclients exist for many languages including Python and C, and you can wrap\nsequences of commands in a tr... | [
2
] | [] | [] | [
"c",
"database",
"dictionary",
"encoding",
"python"
] | stackoverflow_0004741777_c_database_dictionary_encoding_python.txt |
Q:
Keep only lines that end with "@here" (RegEx, Python)
I have a text file with almost a thousand lines such as:
WorldNews,Current
WorldNews,Current,WorldNews@here',
'WorldNewsPro@here Zebra,Poacher',
'Dock,DS_URLs@here'
Zebra,Poacher,ZebraPoacher@here
Zebra,Dock,ZebraDock@here
Timer33,Timer33@here
So... | Keep only lines that end with "@here" (RegEx, Python) | I have a text file with almost a thousand lines such as:
WorldNews,Current
WorldNews,Current,WorldNews@here',
'WorldNewsPro@here Zebra,Poacher',
'Dock,DS_URLs@here'
Zebra,Poacher,ZebraPoacher@here
Zebra,Dock,ZebraDock@here
Timer33,Timer33@here
Sometimes the line ends without "@here" sometimes it ends wit... | [
"Maybe this helps: (assuming filename is the name of your input file)\nwith open(filename) as stream:\n for line in stream:\n if '@here' in line:\n print line\n\n",
"You dont need regex. You can use a string methods to do such simple filtering:\ndef hasstr( lines, s ):\n # a generator expr... | [
3,
1,
1
] | [] | [] | [
"python",
"regex"
] | stackoverflow_0005201490_python_regex.txt |
Q:
Python socket sending problem
I'm currently working on a simple Python script that connects to an IP/Port and lets you preform commands. Kinda like telnet. I want it to connect to lets say MySQL(Just an example) and execute MySQL commands like you would with Telnet or NetCat.
But lets say I connect to a service, I... | Python socket sending problem | I'm currently working on a simple Python script that connects to an IP/Port and lets you preform commands. Kinda like telnet. I want it to connect to lets say MySQL(Just an example) and execute MySQL commands like you would with Telnet or NetCat.
But lets say I connect to a service, I can't execute commands. I'm trying... | [
"Well, no wonder. You never actually call sock.recv on the communicating socket after you send your input.\nPrior to the loop, recvdata contains the \"banner\" from the initial connect. But once you're in the loop, this variable is never changed.\nI believe what you want is:\nsock.connect((host, port))\nrecvdata = ... | [
1,
1
] | [] | [] | [
"connection",
"port",
"python",
"service",
"sockets"
] | stackoverflow_0005201508_connection_port_python_service_sockets.txt |
Q:
Parsing a string of given format to build a binary decision tree
I'm trying to parse a string with parentheses of the form ((Question)(Left_Node)(right_node)).
The question for example will be of the form "if segment size < 1.5,then choose left node, else right". The question can be a dictionary with a key and a v... | Parsing a string of given format to build a binary decision tree | I'm trying to parse a string with parentheses of the form ((Question)(Left_Node)(right_node)).
The question for example will be of the form "if segment size < 1.5,then choose left node, else right". The question can be a dictionary with a key and a value. The left and right node represent a complete left or right half ... | [
"This kind of syntax is really the target for pyparsing. The basic format is simple enough, and in pyparsing, it looks like:\ndecision = '(' + '('+question+')' + '('+action+')' + '('+action+')' + ')'\n\nBut once you start to add arithmetic expressions, and boolean operations and support for 'and' and 'or' operator... | [
1,
0
] | [] | [] | [
"binary_tree",
"parsing",
"python"
] | stackoverflow_0002892716_binary_tree_parsing_python.txt |
Q:
wxPython StaticText Widget Font
How do I set the font on a wxPython StaticText widget?
A:
use object.SetFont. For example (from wxpython in Action):
text = wx.StaticText(panel, -1, 'my text', (20, 100))
font = wx.Font(18, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
text.SetFont(font)
wx.Font has the following signatur... | wxPython StaticText Widget Font | How do I set the font on a wxPython StaticText widget?
| [
"use object.SetFont. For example (from wxpython in Action):\ntext = wx.StaticText(panel, -1, 'my text', (20, 100))\nfont = wx.Font(18, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)\ntext.SetFont(font)\n\nwx.Font has the following signature:\nwx.Font(pointSize, family, style, weight, underline=False, faceName=\"\", encoding=... | [
57
] | [] | [] | [
"python",
"wxpython"
] | stackoverflow_0005201817_python_wxpython.txt |
Q:
Clearing memory used by rpy2
How can I clear objects (and the memory they occupy) created via rpy?
import rpy2.robjects as r
a = r.r('a = matrix(NA, 2000000, 50)')
del a #if I do this, there is no change in the amount of memory used
r.r('rm(list=(ls(all=TRUE)))') # Same here, the objects disappear, but the memo... | Clearing memory used by rpy2 | How can I clear objects (and the memory they occupy) created via rpy?
import rpy2.robjects as r
a = r.r('a = matrix(NA, 2000000, 50)')
del a #if I do this, there is no change in the amount of memory used
r.r('rm(list=(ls(all=TRUE)))') # Same here, the objects disappear, but the memory is still used
The unfortunate ... | [
"There is a paragraph in the rpy docs hinting that you may need to run the Python garbage collector frequently when deleting or overwriting large objects:\n\nR objects live in the R memory space, their size unbeknown to Python, and because of that it seems that Python does not always garbage collect often enough wh... | [
6
] | [] | [] | [
"memory_management",
"python",
"rpy2"
] | stackoverflow_0005199334_memory_management_python_rpy2.txt |
Q:
Reproduce PIPE functionality in IronPython
I am hoping some genious out there can help me out with this...
I am using sox to merge and resample a group of WAV files, and pipe the output directly to the input of NeroAACEnc for encoding to AAC format.
I originally ran the process in a script, which included:
sox.exe... | Reproduce PIPE functionality in IronPython | I am hoping some genious out there can help me out with this...
I am using sox to merge and resample a group of WAV files, and pipe the output directly to the input of NeroAACEnc for encoding to AAC format.
I originally ran the process in a script, which included:
sox.exe d:\audio\1.wav d:\audio\2.wav d:\audio\3.wav -c... | [
"Windows has named pipes and you can use them from .NET applications like IronPython. It is usually straightforward to translate VB.NET examples like this one. You can often find managed libraries for things like this, for instance http://www.codeproject.com/KB/threads/dotnetnamedpipespart1.aspx\nHere is another pr... | [
1
] | [] | [] | [
"ironpython",
"pipe",
"python",
"stdin",
"stdout"
] | stackoverflow_0005201905_ironpython_pipe_python_stdin_stdout.txt |
Q:
Objective-C (cocoa) equivalent to python's endswith/beginswith
Python has string.startswith() and string.endswith() functions which are pretty useful.
What NSString methods can I use to have the same function?
A:
Use -hasPrefix: and -hasSuffix::
NSString *s = @"foobar";
NSLog(@"%d %d\n", [s hasPrefix:@"foo"], [s... | Objective-C (cocoa) equivalent to python's endswith/beginswith | Python has string.startswith() and string.endswith() functions which are pretty useful.
What NSString methods can I use to have the same function?
| [
"Use -hasPrefix: and -hasSuffix::\nNSString *s = @\"foobar\";\nNSLog(@\"%d %d\\n\", [s hasPrefix:@\"foo\"], [s hasSuffix:@\"bar\"]);\n// Output: \"1 1\"\n\n",
"You want the hasPrefix and hasSuffix messages.\nI tend to also use the compare:options: message pretty regularly to achieve the same but with case-insensi... | [
64,
8,
5
] | [] | [] | [
"cocoa",
"objective_c",
"python"
] | stackoverflow_0005201965_cocoa_objective_c_python.txt |
Q:
Custom storage system for GridFS (MongoDB)?
Can anyone point me to any projects/django apps that provide a plugable custom storage system so I can use GridFS with Django to store file uploads?
I've found django-mongodb but it doesnt seem to support GridFS, nor does django-storages.
I plan to run mysql for the norm... | Custom storage system for GridFS (MongoDB)? | Can anyone point me to any projects/django apps that provide a plugable custom storage system so I can use GridFS with Django to store file uploads?
I've found django-mongodb but it doesnt seem to support GridFS, nor does django-storages.
I plan to run mysql for the normal database requrements and only use mongodb for ... | [
"I work on PyMongo, the MongoDB Python driver, and haven't heard of any project to provide custom storage for Django using GridFS. This looks like it wouldn't be very hard to write on top of PyMongo: could probably be a direct translation of the GridFS API onto the Django storage API. Maybe could take a look at thr... | [
3,
1,
1,
1
] | [] | [] | [
"django",
"mongodb",
"python"
] | stackoverflow_0001448386_django_mongodb_python.txt |
Q:
how to change 39.54484700000000 to 39.54 and using python
Possible Duplicate:
python limiting floats to two decimal points
i want to set 39.54484700000000 to 39.54 using python ,
how to get it ,
thanks
A:
If you want to change the actual value, use round as Eli suggested. However for many values and certain v... | how to change 39.54484700000000 to 39.54 and using python |
Possible Duplicate:
python limiting floats to two decimal points
i want to set 39.54484700000000 to 39.54 using python ,
how to get it ,
thanks
| [
"If you want to change the actual value, use round as Eli suggested. However for many values and certain versions of Python this will not result be represented as the string \"39.54\". If you want to just round it to produce a string to display to the user, you can do\n>>> print \"%.2f\" % (39.54484700000000)\n39.5... | [
26,
3,
3,
2,
2,
2
] | [] | [] | [
"floating_point",
"python"
] | stackoverflow_0005202233_floating_point_python.txt |
Q:
best way to get right thing using python
this is my code :
a=[{'x':'aaa','b':'bbbb'},{'x':'a!!!','b':'b!!!'},{'x':'2222','b':'dddd'},{'x':'ddwqd','b':'dwqd'}]
and i want get every 'x' list like this :
['aaa','a!!!','2222','ddwqd']
so which is the best way to get this ,
use map ??
thanks
A:
list comprehension ... | best way to get right thing using python | this is my code :
a=[{'x':'aaa','b':'bbbb'},{'x':'a!!!','b':'b!!!'},{'x':'2222','b':'dddd'},{'x':'ddwqd','b':'dwqd'}]
and i want get every 'x' list like this :
['aaa','a!!!','2222','ddwqd']
so which is the best way to get this ,
use map ??
thanks
| [
"list comprehension can get your x values\nPython 2.7.0+ (r27:82500, Sep 15 2010, 18:04:55) \n[GCC 4.4.5] on linux2\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> a=[{'x':'aaa','b':'bbbb'},{'x':'a!!!','b':'b!!!'},{'x':'2222','b':'dddd'},{'x':'ddwqd','b':'dwqd'}]\n>>> x_values =... | [
6,
4,
1
] | [] | [] | [
"list",
"python"
] | stackoverflow_0005202128_list_python.txt |
Q:
Missing lxml module in python?
I want o use Python-docx library to process word files. A docx.py references lxml, as i assume from
from lxml import etree
When i start the script, i get error:
No module named lxml
Is this a standard library? Why is not it referenced properly then? IronPython 2.7 RC1.
A:
You n... | Missing lxml module in python? | I want o use Python-docx library to process word files. A docx.py references lxml, as i assume from
from lxml import etree
When i start the script, i get error:
No module named lxml
Is this a standard library? Why is not it referenced properly then? IronPython 2.7 RC1.
| [
"You need to install lxml which is not part of the stdlib. I don't know if it will work with IronPython though.\nUpdate: Seems like it might be non-trivial to get lxml working with IronPython. See this question:\n\nHow to get lxml working under IronPython?\n\n"
] | [
3
] | [] | [] | [
"ironpython",
"lxml",
"python",
"python_import"
] | stackoverflow_0005202368_ironpython_lxml_python_python_import.txt |
Q:
bundle_files = 1 fails with py2exe using matplotlib
I am trying to create a standalone application using py2exe that depends on matplotlib and numpy. The code of the application is this:
import numpy as np
import pylab as plt
plt.figure()
a = np.random.random((16,16))
plt.imshow(a,interpolation='nearest')
plt.sho... | bundle_files = 1 fails with py2exe using matplotlib | I am trying to create a standalone application using py2exe that depends on matplotlib and numpy. The code of the application is this:
import numpy as np
import pylab as plt
plt.figure()
a = np.random.random((16,16))
plt.imshow(a,interpolation='nearest')
plt.show()
The setup code for py2exe (modified from http://www.... | [
"I had the same problem. I think the problem was caused by pylab in matplotlib, py2exe seemed to have trouble finding and getting all the backends associated with pylab. \nI got around the problem by changing all my embedded plots to use matplotlib.figure instead of pylab. Here's a simple example on how to make a ... | [
2,
1,
0
] | [] | [] | [
"matplotlib",
"py2exe",
"python"
] | stackoverflow_0004787821_matplotlib_py2exe_python.txt |
Q:
Sinusoids in python
Write the function sinusoid(a, w, n) that will return a list of ordered pairs representing n cycles of a sinusoid with amplitude a and frequency w. Each cycle should contain 180 ordered pairs.
So far I have:
def sinusoid(a,w,n):
return [a*sin(x) for x in range 180]
A:
Please consider the ... | Sinusoids in python | Write the function sinusoid(a, w, n) that will return a list of ordered pairs representing n cycles of a sinusoid with amplitude a and frequency w. Each cycle should contain 180 ordered pairs.
So far I have:
def sinusoid(a,w,n):
return [a*sin(x) for x in range 180]
| [
"Please consider the actual functional form of a sinusoidal wave and how the frequency comes into the equation. (Hint: http://en.wikipedia.org/wiki/Sine_wave).\nNot sure what is meant exactly by 'ordered pairs', but I would assume it means the x,y pairs. Currently you're only returning a list of single values. Also... | [
2,
2
] | [] | [] | [
"python"
] | stackoverflow_0005199163_python.txt |
Q:
Problem with ZSI
I biuld web service with ZSI from example
but after sending request I catch next XML
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" xmlns:xsd="http://www.w3.or... | Problem with ZSI | I biuld web service with ZSI from example
but after sending request I catch next XML
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmln... | [
"here is the right example \nhttp://pywebsvcs.sourceforge.net/holger.pdf\n"
] | [
-1
] | [] | [] | [
"python",
"zsi"
] | stackoverflow_0005202664_python_zsi.txt |
Q:
a string that for every character in it, there exists all the characters which are alphabetically smaller than it before it
How to check for a string that for every character in it, there exists all the characters which are alphabetically smaller than it before it e.g aab is correct while aacb is not, because th... | a string that for every character in it, there exists all the characters which are alphabetically smaller than it before it | How to check for a string that for every character in it, there exists all the characters which are alphabetically smaller than it before it e.g aab is correct while aacb is not, because the second case, we have 'c' but 'b' is not present before it.
Also aac is not correct as it does not have 'b' before 'c'.
| [
"A pseudocode. Works for cases like abac too.\nmax = 'a' - 1 // character immediately before 'a'\n\nfor char in string\n if char > max + 1\n // bad string, stop algorithm\n end\n\n if char > max\n max = char\n end\nend\n\nThe idea is that we need to check only that the character preceding the current one... | [
5,
1,
1,
0,
0,
0,
0
] | [] | [] | [
"algorithm",
"python",
"string"
] | stackoverflow_0005202362_algorithm_python_string.txt |
Q:
How read a portion of a file (parsing), interrupt on a "<" char in python?
I Need to parse a html file in python, and stock the content in a list.
Example: ['<html>', '<head>', '<meta name="robots" content="noindex">']
Here is what i have for now on the buggish function:
def getTexte(fp,compte=0): #returns the tex... | How read a portion of a file (parsing), interrupt on a "<" char in python? | I Need to parse a html file in python, and stock the content in a list.
Example: ['<html>', '<head>', '<meta name="robots" content="noindex">']
Here is what i have for now on the buggish function:
def getTexte(fp,compte=0): #returns the text before a html tag
txt=""
pos=fp.tell() #stock the curr position for la... | [
"As others have said in their comments you really don't want to attempt to write an HTML parser by iterating over input as a series of characters. Your code fragment's references to tell() and read() methods suggest that you're thinking of this in terms of walking through an open file rather than even thinking at ... | [
4,
0
] | [] | [] | [
"file",
"parsing",
"python"
] | stackoverflow_0005202721_file_parsing_python.txt |
Q:
Problem with saving image
I have a problem with saving an image. I have following part of code:
self.canvas.postscript(file = filename, colormode = "color")
It works good, but when I set background color in canvas constructor (f.e. bg='red'),
finally image doesn't have this background color. It is still white.
Co... | Problem with saving image | I have a problem with saving an image. I have following part of code:
self.canvas.postscript(file = filename, colormode = "color")
It works good, but when I set background color in canvas constructor (f.e. bg='red'),
finally image doesn't have this background color. It is still white.
Could anybody help me ?
| [
"Sounds like you're using Tkinter: is that right?\nI believe the problem is that the bg argument is a general property shared by all widgets. It's really a part of how the widget is drawn on the screen and not a part of the image you're constructing in your canvas. I think the easiest thing for you to do is to draw... | [
2
] | [] | [] | [
"background",
"canvas",
"postscript",
"python"
] | stackoverflow_0005203102_background_canvas_postscript_python.txt |
Q:
Tests and python package structure
I have some problems in structuring my python project. Currently it is a bunch of files in the same folder. I have tried to structure it like
proj/
__init__.py
foo.py
...
bar/
__init__.py
foobar.py
...
tests/
foo_test.py
foobar_test.py
...
The p... | Tests and python package structure | I have some problems in structuring my python project. Currently it is a bunch of files in the same folder. I have tried to structure it like
proj/
__init__.py
foo.py
...
bar/
__init__.py
foobar.py
...
tests/
foo_test.py
foobar_test.py
...
The problem is that I'm not able, from inner ... | [
"When you use the -m switch to run code, the current directory is added to sys.path. So the easiest way to run your tests is from the parent directory of proj, using the command:\npython -m proj.tests.foo_test\n\nTo make that work, you will need to include an __init__.py file in your tests directory so that the tes... | [
13,
5
] | [] | [] | [
"package",
"python"
] | stackoverflow_0005197333_package_python.txt |
Q:
What is the Windows equivalent of pwd.getpwnam(username).pw_dir?
The Python pwd module provides access to getpwnam(3) POSIX API, which can be used to get the home directory for a particular user by username, as well determining if the username is valid at all. pwd.getpwnam will raise an exception if called with a... | What is the Windows equivalent of pwd.getpwnam(username).pw_dir? | The Python pwd module provides access to getpwnam(3) POSIX API, which can be used to get the home directory for a particular user by username, as well determining if the username is valid at all. pwd.getpwnam will raise an exception if called with a non-existent username.
At first it seems like the same result can be ... | [
"Reading the 2.6 documentation shows that os.path.expanduser() is broken on Windows:\n\nOn Windows, HOME and USERPROFILE will\n be used if set, otherwise a\n combination of HOMEPATH and HOMEDRIVE\n will be used. An initial ~user is\n handled by stripping the last\n directory component from the created\n user ... | [
4,
3,
0,
0
] | [] | [] | [
"home_directory",
"python",
"windows"
] | stackoverflow_0003305787_home_directory_python_windows.txt |
Q:
Python 2.7/Windows: How to control position of Tkinter common dialogs?
Python 2.7 under Windows: How can we control the position of Tkinter's common dialogs?
Here's what we've discovered:
Certain common dialogs always open up relative to their parent window
Certain common dialogs always open up centered on the us... | Python 2.7/Windows: How to control position of Tkinter common dialogs? | Python 2.7 under Windows: How can we control the position of Tkinter's common dialogs?
Here's what we've discovered:
Certain common dialogs always open up relative to their parent window
Certain common dialogs always open up centered on the user's desktop
All common dialogs appear to ignore the optional parent= parame... | [
"For the Windows messagebox you can't. It appears in the center of the screen and that is that. However, the file selection dialog and color chooser are system dialogs that have been given a Tk wrapper so that users see the stock dialogs on this platform. If you set the -parent option then this is passed through to... | [
1
] | [] | [] | [
"python",
"tkinter",
"ttk",
"windows"
] | stackoverflow_0003999153_python_tkinter_ttk_windows.txt |
Q:
GAE redirection with a delay
Is that possible to redirect to another url with a delay in GAE? I know I can use JavaScript for this purpose, but may be there is a way to do delayed redirection without it?
Now I use self.redirect("/") from GAE tutorial.
Thanks.
A:
You can use the <meta http-equiv="refresh" content... | GAE redirection with a delay | Is that possible to redirect to another url with a delay in GAE? I know I can use JavaScript for this purpose, but may be there is a way to do delayed redirection without it?
Now I use self.redirect("/") from GAE tutorial.
Thanks.
| [
"You can use the <meta http-equiv=\"refresh\" content=\"x;url=http://yoururl/\"> tag where x is the number of seconds to wait before redirect.\nThis tag would go in <head> part of the generated page.\n",
"import time at the top of your module and do a time.sleep(0.5) before you do a self.redirect call. The sleep... | [
8,
1
] | [] | [] | [
"google_app_engine",
"python",
"redirect"
] | stackoverflow_0005203378_google_app_engine_python_redirect.txt |
Q:
Behavior of Python print which I am unable to understand
My code snippet look like this:
from time import sleep
for i in xrange(10):
status = "hello%s" % str(i)
status = status + chr(8)*(len(status)+1)
sleep(1)
print status
which behaves differently with
print status
and
print status,
Now when i... | Behavior of Python print which I am unable to understand | My code snippet look like this:
from time import sleep
for i in xrange(10):
status = "hello%s" % str(i)
status = status + chr(8)*(len(status)+1)
sleep(1)
print status
which behaves differently with
print status
and
print status,
Now when i use a comma after print status then print outputs to stdout o... | [
"The console terminal is line buffered which mean that the console buffer will be flushed when it will found a new line character \\n , which explain the behavior that you see now, because when you do print status print will print automatically a new line character which will flush the console buffer after the prin... | [
5,
2,
1
] | [] | [] | [
"printing",
"python"
] | stackoverflow_0005203415_printing_python.txt |
Q:
Modulus operation with negatives values - weird thing?
Can you please tell me how much is (-2) % 5?
According to my Python interpreter is 3, but do you have a wise explanation for this?
I've read that in some languages the result can be machine-dependent, but I'm not sure though.
A:
By the way: most programming ... | Modulus operation with negatives values - weird thing? | Can you please tell me how much is (-2) % 5?
According to my Python interpreter is 3, but do you have a wise explanation for this?
I've read that in some languages the result can be machine-dependent, but I'm not sure though.
| [
"By the way: most programming languages would disagree with Python and give the result -2. Depending on the interpretation of modulus this is correct. However, the most agreed-upon mathematical definition states that the modulus of a and b is the (strictly positive) rest r of the division of a / b. More precisely, ... | [
16,
14,
14,
6,
4,
3,
0,
0,
0,
0,
0,
0
] | [] | [] | [
"math",
"modulo",
"python"
] | stackoverflow_0000043775_math_modulo_python.txt |
Q:
How to implement Unicode string matching by folding in python
I have an application implementing incremental search. I have a catalog of unicode strings to be matched and match them to a given "key" string; a catalog string is a "hit" if it contains all of the characters in the key, in order, and it is ranked bett... | How to implement Unicode string matching by folding in python | I have an application implementing incremental search. I have a catalog of unicode strings to be matched and match them to a given "key" string; a catalog string is a "hit" if it contains all of the characters in the key, in order, and it is ranked better if the key characters cluster in the catalog string.
Anyway, thi... | [
"You can use this strip_accents function to remove the accents:\ndef strip_accents(s):\n return ''.join((c for c in unicodedata.normalize('NFD', unicode(s)) if unicodedata.category(c) != 'Mn'))\n\n>>> strip_accents(u'Östblocket')\n'Ostblocket'\n\n",
"\nFor my application, I already addressed this in a different... | [
7,
4,
1,
1,
1
] | [] | [] | [
"python",
"unicode"
] | stackoverflow_0001410308_python_unicode.txt |
Q:
Using ctypes with jython
I have a trouble with using ctypes lib in my python script. Here is my code (found on the Internet):
if __name__ == "__main__":
from ctypes import *
user32 = windll.user32
kernel32 = windll.kernel32
class RECT(Structure):
_fields_ = [
("left", c_ulong),... | Using ctypes with jython | I have a trouble with using ctypes lib in my python script. Here is my code (found on the Internet):
if __name__ == "__main__":
from ctypes import *
user32 = windll.user32
kernel32 = windll.kernel32
class RECT(Structure):
_fields_ = [
("left", c_ulong),
("top", c_ulong),... | [
"ctypes in Jython experimental and not complete. \nFrom the jython-users mailing list in a thread titled \"ctypes in Jython\" Jim Baker (a Jython committer) wrote on November 17, 2010:\n\nThere's some experimental support for\n ctypes in 2.5.2 [the current version], but it's really more\n of a placeholder at thi... | [
7,
3,
1,
0
] | [] | [] | [
"ctypes",
"jython",
"python"
] | stackoverflow_0005186670_ctypes_jython_python.txt |
Q:
Broadcasting a python function on to numpy arrays
Let's say we have a particularly simple function like
import scipy as sp
def func(x, y):
return x + y
This function evidently works for several builtin python datatypes of x and y like string, list, int, float, array, etc. Since we are particularly interested i... | Broadcasting a python function on to numpy arrays | Let's say we have a particularly simple function like
import scipy as sp
def func(x, y):
return x + y
This function evidently works for several builtin python datatypes of x and y like string, list, int, float, array, etc. Since we are particularly interested in arrays, we consider two arrays:
x = sp.array([-2, -1,... | [
"np.vectorize is a general way to convert Python functions that operate on numbers into numpy functions that operate on ndarrays.\nHowever, as you point out, it isn't very fast, since it is using a Python loop \"under the hood\".\nTo achieve better speed, you have to hand-craft a function that expects numpy arrays ... | [
15,
13,
1
] | [] | [] | [
"numpy",
"python",
"scipy"
] | stackoverflow_0005197650_numpy_python_scipy.txt |
Q:
Python or PyPy for small group and large project?
Early stage of planning a large project - difficult decision of choosing frameworks :)
In mind:
"select way - run fast".
Select technologies with growth opportunity, prototype as fast as possible.
"look at horizon - build a ship".
Understand the scope, invest in... | Python or PyPy for small group and large project? | Early stage of planning a large project - difficult decision of choosing frameworks :)
In mind:
"select way - run fast".
Select technologies with growth opportunity, prototype as fast as possible.
"look at horizon - build a ship".
Understand the scope, invest in difficult decision but reach the goal.
"take the best ... | [
"Go with CPython. All known bindings to external libraries or whatever are supposed to work with CPython. I doubt that you will have success with PyPy here. Just from the prospective of risk management in large projects: stay mainstream.\n",
"Python (assuming you mean the CPython implementation) and PyPy are not ... | [
5,
5,
3,
0
] | [] | [] | [
"couchdb",
"django",
"pylons",
"pypy",
"python"
] | stackoverflow_0005180099_couchdb_django_pylons_pypy_python.txt |
Q:
not all arguments converted during string formatting
thumbnail and image are BLOB field, num1 and num2 are Integer field, others are Str.
I want to insert binary data into MYSQL. But When this line called, error occured.
cursor.execute("INSERT INTO image(num1, num2, filename, ext, thumbnail, image) VALUES(?, ?, ?,... | not all arguments converted during string formatting | thumbnail and image are BLOB field, num1 and num2 are Integer field, others are Str.
I want to insert binary data into MYSQL. But When this line called, error occured.
cursor.execute("INSERT INTO image(num1, num2, filename, ext, thumbnail, image) VALUES(?, ?, ?, ?, ?, ?);" , (num1, num2, _name, _ext, _thumb, _image))
... | [
"If you are using MySQLdb, try:\ncursor.execute(\"\"\"\n INSERT INTO image\n (num1, num2, filename, ext, thumbnail, image) VALUES\n (%s, %s, %s, %s, %s, %s)\"\"\" , (num1, num2, _name, _ext, _thumb, _image))\n\n"
] | [
5
] | [] | [] | [
"mysql",
"python"
] | stackoverflow_0005204190_mysql_python.txt |
Q:
wxPython Equivalent to Tkinter .after()
Is there an equivalent to Tkinter's .after() in wxPython?
For those that don't know .after() allows the running of functions at some point in the future. This can be used to make loops with functions.
I'm attempting to make a clock, so this would be handy for making it tic... | wxPython Equivalent to Tkinter .after() | Is there an equivalent to Tkinter's .after() in wxPython?
For those that don't know .after() allows the running of functions at some point in the future. This can be used to make loops with functions.
I'm attempting to make a clock, so this would be handy for making it tick.
| [
"To answer your specific question, you can use wx.CallAfter and wx.CallLater. The former is roughly equivalent to tkinter's after_idle command, and the latter is the same as after (ie: it takes a number of milliseconds to wait as an argument)\nAs a third option you can use wx.Timer, upon which wx.CallLater is based... | [
4,
1
] | [] | [] | [
"python",
"tkinter",
"wxpython"
] | stackoverflow_0005201876_python_tkinter_wxpython.txt |
Q:
google app engine _method?
How can I get the request body passed on to my views?
class RestHTTPMiddleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
request = Request(environ)
environ['wsgi.input'] = StringIO.StringIO(request.body)
method = w... | google app engine _method? | How can I get the request body passed on to my views?
class RestHTTPMiddleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
request = Request(environ)
environ['wsgi.input'] = StringIO.StringIO(request.body)
method = webapp.Request(environ).get('_met... | [
"You're almost there with this code, I think. Did you try and see if it works if you run fp.seek(0) after the Request instance is created?\nI should also note that this is a dangerous hack! This allows me to trick your Web server into believing that an <img src=\"http://yourserver.com/?_method=POST&delete_account=1... | [
0
] | [] | [] | [
"google_app_engine",
"python"
] | stackoverflow_0003696170_google_app_engine_python.txt |
Q:
How can I enumerate Applications?
I'd like to get information like window name, process, creation time and such under windows XP system.
How can I do it? Is there a module that may give me that information?
Thanks.
A:
Take a look at the Python bindings for the Win32 API. For the rest, I've had better luck with ... | How can I enumerate Applications? | I'd like to get information like window name, process, creation time and such under windows XP system.
How can I do it? Is there a module that may give me that information?
Thanks.
| [
"Take a look at the Python bindings for the Win32 API. For the rest, I've had better luck with the Win32 API's documentation than that of the Python bindings. For your process enumeration task, take a look at the documentation on Process Information (Windows).\n"
] | [
2
] | [] | [] | [
"python",
"windows"
] | stackoverflow_0005204408_python_windows.txt |
Q:
Way to avoid downloading file twice via IMAP
I'm writing a script in Python that saves attachments from Gmail, only from unseen emails. To save on bandwidth I want to make sure that every file only gets downloaded once.
-I can't check the folder where I save them, because the file could be removed already, and the... | Way to avoid downloading file twice via IMAP | I'm writing a script in Python that saves attachments from Gmail, only from unseen emails. To save on bandwidth I want to make sure that every file only gets downloaded once.
-I can't check the folder where I save them, because the file could be removed already, and then it shouldn't download again. (The scripts access... | [
"There are several open source projects in Python that already perform this task very well. Why don't you take a look at OfflineIMAP and getmail's source code. Also, if you're just trying to backup your GMail account, I suggest you use one of those rather than rolling your own...\n",
"You could not only save th... | [
1,
0,
0
] | [] | [] | [
"imaplib",
"python"
] | stackoverflow_0005204339_imaplib_python.txt |
Q:
json formatting in python
records variable contains following data
[(38177492.733055562, 38177482.886388876), (39370533.190833323,
40563588.018611118), (34598340.198888883,
33405299.966944441), (40563586.926666655,
35791393.990277782), (35791394.635833345,
36984434.221388899), (33405296.804722216,
3817... | json formatting in python | records variable contains following data
[(38177492.733055562, 38177482.886388876), (39370533.190833323,
40563588.018611118), (34598340.198888883,
33405299.966944441), (40563586.926666655,
35791393.990277782), (35791394.635833345,
36984434.221388899), (33405296.804722216,
38177491.020277783), (38177487.7161... | [
"datalist['data'] = record works ?\n",
"I have a feeling you really don't need a defaultdict here, a normal dict will do just fine.\ndatalist = {}\ndatalist['startdate'] = startDate\ndatalist['enddate'] = endDate\n\n"
] | [
2,
2
] | [] | [] | [
"json",
"python"
] | stackoverflow_0005204417_json_python.txt |
Q:
Grouping CheckboxSelectMultiple Options in Django
In my Django App I have the following model:
class SuperCategory(models.Model):
name = models.CharField(max_length=100,)
slug = models.SlugField(unique=True,)
class Category(models.Model):
name = models.CharField(max_length=100,)
slug ... | Grouping CheckboxSelectMultiple Options in Django | In my Django App I have the following model:
class SuperCategory(models.Model):
name = models.CharField(max_length=100,)
slug = models.SlugField(unique=True,)
class Category(models.Model):
name = models.CharField(max_length=100,)
slug = models.SlugField(unique=True,)
super_category = m... | [
"After some struggle, here is what I got.\nFirst, make ModelAdmin call a ModelForm: \nclass OptionAdmin(admin.ModelAdmin):\n\n form = forms.OptionForm\n\nThen, in the form, use use a custom widget to render:\ncategory = forms.ModelMultipleChoiceField(queryset=models.Category.objects.all(),widget=AdminCategoryB... | [
5
] | [] | [] | [
"django",
"django_admin",
"django_widget",
"python"
] | stackoverflow_0005200911_django_django_admin_django_widget_python.txt |
Q:
Use python to automate interaction?
Is it possible to use python in order to automate interaction in Linux? (for example, sending "Yes" to StdInput whenever the string "Are you sure?" is sent to StdOutput)
Thanks.
A:
Yes, take a look at pexpect.
| Use python to automate interaction? | Is it possible to use python in order to automate interaction in Linux? (for example, sending "Yes" to StdInput whenever the string "Are you sure?" is sent to StdOutput)
Thanks.
| [
"Yes, take a look at pexpect.\n"
] | [
6
] | [] | [] | [
"automation",
"linux",
"python"
] | stackoverflow_0005204431_automation_linux_python.txt |
Q:
What are the essentials I need to install if I want to use PostgreSQL DB with zope? for eg: Zope Database Adapter?
I am into a project where zope web server is used. With this PostgreSQL database is used. But I am not able to add a new PostgreSQL connection via zope. Actually, I am not aware of what else I need to... | What are the essentials I need to install if I want to use PostgreSQL DB with zope? for eg: Zope Database Adapter? | I am into a project where zope web server is used. With this PostgreSQL database is used. But I am not able to add a new PostgreSQL connection via zope. Actually, I am not aware of what else I need to install so that I can use PostgreSQL dB with zope. From whatever I have explored about this I have come to know that I ... | [
"Look at psycopg, it ships with a Zope Database Adapter.\n",
"Psycopg2 is absolutely required but is not sufficient. Psycopg2 provides the low-level python database interface.\nThere are quite a few ways to provide database interconnection, and it depends what exactly you want to do.\nNo matter what solution you... | [
0,
0
] | [] | [] | [
"python",
"zope"
] | stackoverflow_0003719145_python_zope.txt |
Q:
Why bother to limit the types imported from a python package?
When using many IDEs that support autocompletion with Python, things like this will show warnings, which I find annoying:
from eventlet.green.httplib import BadStatusLine
When switching to:
from eventlet.green.httplib import *
The warnings go away. Wh... | Why bother to limit the types imported from a python package? | When using many IDEs that support autocompletion with Python, things like this will show warnings, which I find annoying:
from eventlet.green.httplib import BadStatusLine
When switching to:
from eventlet.green.httplib import *
The warnings go away. What's the benefit to limiting imports to a specific set of types you... | [
"By typing from foo import *, you import all the names defined in foo into the global namespace. This is bad practice because you could have name clashes both with other modules and with built-ins.\nFor example, consider a module foo\n#foo.py\ndef open(something):\n pass\n\nand a module bar:\n#bar.py\ndef open(s... | [
4,
1
] | [] | [] | [
"python"
] | stackoverflow_0005204640_python.txt |
Q:
Python threading design question (Working with a method that blocks forever)
UPDATED POST
So, I found a solution to what I was doing it is to use Is there any way to kill a Thread in Python?
I would like to get some validation on design. We have a fairly large system, and one components of the system is the comm... | Python threading design question (Working with a method that blocks forever) | UPDATED POST
So, I found a solution to what I was doing it is to use Is there any way to kill a Thread in Python?
I would like to get some validation on design. We have a fairly large system, and one components of the system is the communication component. It is in charge of two things, one sending messages, and two... | [
"What function ultimately waits for a message to come? Most probably there's a way to make it time out and thus check a termination flag periodically. \n",
"1) If your third thread is just going to be waiting on the receiver and sender, there is no need. \nWorking with multiple processes is less convenient than m... | [
0,
0,
0
] | [] | [] | [
"algorithm",
"multithreading",
"python",
"thread_safety"
] | stackoverflow_0004997346_algorithm_multithreading_python_thread_safety.txt |
Q:
Python: How to terminate a blocking thread
Possible Duplicate:
Is there any way to kill a Thread in Python?
So this question is a follow up to a solution posted previously. Basically it deals with programatically terminating a thread: http://sebulba.wikispaces.com/recipe+thread2
However it doesnt work... and I... | Python: How to terminate a blocking thread |
Possible Duplicate:
Is there any way to kill a Thread in Python?
So this question is a follow up to a solution posted previously. Basically it deals with programatically terminating a thread: http://sebulba.wikispaces.com/recipe+thread2
However it doesnt work... and I was wondering if someone can explain how one c... | [
"Here is a better way to do it, use the \"wait\" command on the event, asssuming you want to use sleep. \nclass BlockingTestThread(Thread):\n def __init__(self):\n self._running_flag = False\n self.stop = threading.Event()\n Thread.__init__(self, target=self.test_method)\n\n def test_me... | [
3,
0
] | [] | [] | [
"multithreading",
"python"
] | stackoverflow_0005019436_multithreading_python.txt |
Q:
Help with Python: login into website
I'm trying to connect to a website with Python, but I don't know how to do that.
The HTML of the website looks like that :
<form action="connexion.php" method="post">
User<br />
<input name="login_user" type="text" />
<br />
Password<br />
<input name="pass_word" type... | Help with Python: login into website | I'm trying to connect to a website with Python, but I don't know how to do that.
The HTML of the website looks like that :
<form action="connexion.php" method="post">
User<br />
<input name="login_user" type="text" />
<br />
Password<br />
<input name="pass_word" type="password" />
<br />
<input value="Co... | [
"You can use urllib Module to open any website and get its HTML code. but if you want to use python to receive data from your HTML Form, you should learn one of web frameworks like: Django, webpy or Flask.\nEdit: You should replace \"req_username\" with \"login_user\", and \"req_password\" with \"pass_word\". \n",
... | [
1,
1,
1
] | [] | [] | [
"connection",
"html",
"python"
] | stackoverflow_0005203865_connection_html_python.txt |
Q:
I got "AttributeError: World instance has no attribute 'fire' " while executing below code. what should i do?
class World(DirectObject):
def __init__(self):
..........................
..........................
..........................
if (self.keyMap["fire"] !=0 and task.time > task... | I got "AttributeError: World instance has no attribute 'fire' " while executing below code. what should i do? | class World(DirectObject):
def __init__(self):
..........................
..........................
..........................
if (self.keyMap["fire"] !=0 and task.time > task.nextBullet):
self.fire(task.time,self.panda.getPos(), self.panda.getHpr(), bulletSpeed, bulletLife)
... | [
"Is def fire(...) at the same level of indentation as def __init__(...)?\nIf not, there lies the problem.\nIn the code you posted, fire is being defined as a plain function inside the __init__ method (which just so happens to have self as its first argument).\n"
] | [
2
] | [] | [] | [
"python"
] | stackoverflow_0005205291_python.txt |
Q:
Python Singletons syntax and why its looks like that?
my first question here:
I've searched the internet and also read several question and answers here before and finally figured out the way of writing the singleton classes for my python codes.
I've also read the python documentation about the new() function and ... | Python Singletons syntax and why its looks like that? | my first question here:
I've searched the internet and also read several question and answers here before and finally figured out the way of writing the singleton classes for my python codes.
I've also read the python documentation about the new() function and some other things but still confused about how and what is ... | [
"You should use modules as singletons in python, because they behave exactly like one.\nHere is another question: Is there a simple, elegant way to define singletons?\n",
"First of all, this is wrong:\nclass Singleton(object):\n def __new__(cls, *args, **kwargs):\n if '_inst' not in vars(cls): # <-- thi... | [
2,
2,
2
] | [] | [] | [
"new_operator",
"program_entry_point",
"python",
"singleton",
"syntax"
] | stackoverflow_0005205310_new_operator_program_entry_point_python_singleton_syntax.txt |
Q:
XPath: Select Current and Next Node's text by Current Node Attributes
If this is a repeat question, I apologize, but I can't find another question either on SO or elsewhere that seems to handle what I need. Here is my question:
I'm using scrapy to get some information out of this webpage. For clarity, following is... | XPath: Select Current and Next Node's text by Current Node Attributes | If this is a repeat question, I apologize, but I can't find another question either on SO or elsewhere that seems to handle what I need. Here is my question:
I'm using scrapy to get some information out of this webpage. For clarity, following is a block of the source code from that webpage, which is of interest to me:
... | [
"\n.1. ANT101H5 Introduction to Biological Anthropology and Archaeology\n\np[@class='titlestyle']/text()\n\n\n.2. Exclusion: ANT100Y5\n\nconcat(\n span/span[@class='title2'][1],\n span/span[@class='title2'][1]/following-sibling::a[1]\n )\n\n\n.3. Prerequisite: ANT102H5\n\nconcat(\n span/span[@class='tit... | [
3,
2,
1
] | [] | [] | [
"python",
"scrapy",
"xpath"
] | stackoverflow_0005202187_python_scrapy_xpath.txt |
Q:
twisted conch filetransfer
I am trying to implement a very simple file transfer client in python using twisted conch. The client should simply transfer a few files to a remote ssh/sftp server in a programatic way. The function is given username, password, file list, destination server:directory and just needs to c... | twisted conch filetransfer | I am trying to implement a very simple file transfer client in python using twisted conch. The client should simply transfer a few files to a remote ssh/sftp server in a programatic way. The function is given username, password, file list, destination server:directory and just needs to carry out the authentication and ... | [
"Doing an SFTP file transfer with Twisted Conch involves a couple distinct phases (well, they're distinct if you squint). Basically, first you need to get a connection set up with a channel open on it with an sftp subsystem running on it. Whew. Then you can use the methods of a FileTransferClient instance connec... | [
35,
0
] | [] | [] | [
"python",
"scp",
"sftp",
"ssh",
"twisted"
] | stackoverflow_0005195427_python_scp_sftp_ssh_twisted.txt |
Q:
Catching an exception while using a Python 'with' statement - Part 2
this is a continuation of question Catching an exception while using a Python 'with' statement.
I'm quite e newbie and I tested the following code with Python 3.2 on GNU/linux.
In the above-mentioned question, something similar to this was propos... | Catching an exception while using a Python 'with' statement - Part 2 | this is a continuation of question Catching an exception while using a Python 'with' statement.
I'm quite e newbie and I tested the following code with Python 3.2 on GNU/linux.
In the above-mentioned question, something similar to this was proposed to catch an exception from a 'with' statement:
try:
with open('foo.... | [
"try:\n f = open('foo.txt', 'a')\nexcept IOError:\n print('error')\nelse:\n with f:\n #\n # some_code\n #\n\n"
] | [
20
] | [] | [] | [
"exception",
"exception_handling",
"python",
"with_statement"
] | stackoverflow_0005205811_exception_exception_handling_python_with_statement.txt |
Q:
Iterating in Python and BeautifulSoup
soup = BeautifulSoup(html).findAll('div', 'thread')
for i in soup:
print i
I'll take only this part of the code because that's where I'm getting stuck in.
Soup returns a list, I tried to use ' '.join() to have a literal string and it didn't work, because it's expected a... | Iterating in Python and BeautifulSoup | soup = BeautifulSoup(html).findAll('div', 'thread')
for i in soup:
print i
I'll take only this part of the code because that's where I'm getting stuck in.
Soup returns a list, I tried to use ' '.join() to have a literal string and it didn't work, because it's expected a string, not a tag. I guess it's sort of bu... | [
"It should be something like\ndivs = BeautifulSoup(html).findAll('div','thread') \nfor div in divs: \n print div.find('a').attr['href'] # may it be map(a.attrs)['href'], I don't remember now\n\n",
"taking a look at the documentation for this module/class (http://www.crummy.com/software/BeautifulSoup/document... | [
2,
1
] | [] | [] | [
"beautifulsoup",
"python"
] | stackoverflow_0005205904_beautifulsoup_python.txt |
Q:
python decorator that call a function with delay
why this code does not work?
from threading import Timer
def delayed(seconds):
def decorator(f):
def wrapper(*args, **kargs):
Timer(seconds, f, args, kargs)
return wrapper
return decorator
@delayed(1)
def foo():
'''this func... | python decorator that call a function with delay | why this code does not work?
from threading import Timer
def delayed(seconds):
def decorator(f):
def wrapper(*args, **kargs):
Timer(seconds, f, args, kargs)
return wrapper
return decorator
@delayed(1)
def foo():
'''this function does not return'''
print('foo')
foo()
print(... | [
"Because you didn't start your timer try like this:\nfrom threading import Timer\n\ndef delayed(seconds):\n def decorator(f):\n def wrapper(*args, **kargs):\n t = Timer(seconds, f, args, kargs)\n t.start()\n return wrapper\n return decorator\n\n@delayed(1)\ndef foo():\n\n ... | [
5
] | [] | [] | [
"python",
"timer"
] | stackoverflow_0005205995_python_timer.txt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.