Title
stringlengths
15
150
A_Id
int64
2.98k
72.4M
Users Score
int64
-17
470
Q_Score
int64
0
5.69k
ViewCount
int64
18
4.06M
Database and SQL
int64
0
1
Tags
stringlengths
6
105
Answer
stringlengths
11
6.38k
GUI and Desktop Applications
int64
0
1
System Administration and DevOps
int64
1
1
Networking and APIs
int64
0
1
Other
int64
0
1
CreationDate
stringlengths
23
23
AnswerCount
int64
1
64
Score
float64
-1
1.2
is_accepted
bool
2 classes
Q_Id
int64
1.85k
44.1M
Python Basics and Environment
int64
0
1
Data Science and Machine Learning
int64
0
1
Web Development
int64
0
1
Available Count
int64
1
17
Question
stringlengths
41
29k
Preserve POST variables during login redirect in GAE?
6,084,633
1
3
375
0
python,google-app-engine,http-post
The general problem with capturing a POST and turning it into a GET is first that the query string on a GET has a browser-dependent limited size, and second that a POST may be form/multi-part (what to do with the uploaded file becomes an issue). An approach that might work for you is to accept the POST and save the dat...
0
1
0
0
2011-05-21T20:01:00.000
2
0.099668
false
6,084,123
0
0
1
1
in a form, I submit data to a python webapp handler (all Google App Engine based) using a HTTP POST request. In this script, I first check if the user is logged in and if not, I use users.create_login_url(...) to redirect the user first to the login page. How can I ensure that after login the user is not just forwarded...
How to set a file's ctime with Python?
6,085,044
9
7
4,201
0
python,unix,stat,ctime
It is relatively trivial to set a files ctime to the current time. Just modify its mtime, flip a permission bit or even make a hardlink to it. It is, AFAIK, impossible to set a file's ctime to an arbitrary value using the system call API in any direct sort of way. If you had root access you could set the system time, d...
0
1
0
0
2011-05-21T23:06:00.000
1
1.2
true
6,084,985
1
0
0
1
How can I set a Unix file's ctime? (I'd much prefer an answer in terms of Python. If there's no way to do it with standard Python, then I suppose C is OK too.) (Note: I know that one can use os.utime to set a file's atime and mtime. I am interested in setting ctime.) (Note2: I hope that there's an answer that works f...
Keeping the downloaded torrent in memory rather than file libtorrent
6,090,293
4
3
1,739
0
c++,python,bittorrent
If you're on Linux, you could torrent into a tmpfs mount; this will avoid writing to disk. That said, this obviously means you're storing large files in RAM; make sure you have enough memory to deal with this. Note also that most Linux distributions have a tmpfs mount at /dev/shm, so you could simply point libtorrent t...
0
1
0
1
2011-05-22T18:11:00.000
4
0.197375
false
6,089,806
0
0
0
1
Working with Rasterbar libtorrent I dont want the downloaded data to sit on my hard drive rather a pipe or variable or something Soft so I can redirect it to somewhere else, Mysql, or even trash if it is not what I want, is there anyway of doing this in preferably python binding if not in C++ using Libtorrent? EDIT:-->...
How to use backends in google app engine without wasting cpu resources?
6,098,645
1
1
1,080
0
python,google-app-engine,google-cloud-datastore,backend
The general advice for optimizing CPU usage is to minimize RPCs, understand how to use the datastore efficiently and use appstats to find your bottlenecks. For specific optimization advice, we would need to see some code. While backends can be configured to handle public requests, they aren't intended to replace normal...
0
1
0
0
2011-05-23T11:55:00.000
1
1.2
true
6,096,806
0
0
1
1
While processing data in datastore using backends, app engine is using my cpu resources completely. How do i process my data without wasting CPU resources? Can i have the entire app on a backend without wasting cpu resources? am i missing something.. if the question is too vague, ask me to clarify.. thanks
Does reportlab's renderPM work on Google appengine?
6,166,841
0
2
234
0
python,image,google-app-engine,reportlab
Just to close the question - as indicated by Wooble, reportlab itself works fine on Appengine (being pure python) but the RenderPM library doesn't.
0
1
0
0
2011-05-23T15:45:00.000
1
1.2
true
6,099,592
0
0
1
1
I wanted to use ReportLab's RenderPM to generate images on Google App-Engine but it looks like it depends on c libraries. Does anyone know if it's possible to get it working? Thanks, Richard
Multiple installs of Python on MacOSX for Eclipse
6,103,695
0
2
1,353
0
python,macos,pydev,virtualenv,python-2.x
From the README text file of python Installing multiple versions On Unix and Mac systems if you intend to install multiple versions of Python using the same installation prefix (--prefix argument to the configure script) you must take care that your primary python executable is not overwritten by the insta...
0
1
0
0
2011-05-23T22:07:00.000
4
0
false
6,103,592
1
0
0
1
I want to have multiple installs of Python: 2.1, 2.4, 2.7, 3.x My IDE is Eclipse (Helios)/Pydev on MacOSX, which works great. I have a couple of Python codebases that are/will be running on different versions of Python. Also, I like Eclipse PyDev's crosslinking from source-code to documentation. The standard recommenda...
Specific IDE, for specific things
6,105,339
5
3
343
0
java,python,ide,editor
notepad++ has an ftp plugin that works very nicely and runs on very little resource. Will syntax highlight most languages and has some compiler support.
0
1
0
0
2011-05-24T03:00:00.000
6
0.16514
false
6,105,273
1
0
0
2
I need an IDE that can do the following: Run on an oldish laptop (2GB Ram, 1.9 ghz intel celeron M) Run well on an oldish laptop (with a browswer open) Be able to run on windows Be able to run smoothly on windows Is able to do Java (or, if you really can't find anything, C# will be okay) An extension or something for ...
Specific IDE, for specific things
6,105,523
0
3
343
0
java,python,ide,editor
Use the IDE and tools that makes you the most productive. Use the IDE and tools that you want to use. Use the IDE and tools that you will enjoy using. If your computer is preventing you from doing that, then get a new computer. Long gone are the days when labor was cheap, and hardware expensive. These days hardware is ...
0
1
0
0
2011-05-24T03:00:00.000
6
0
false
6,105,273
1
0
0
2
I need an IDE that can do the following: Run on an oldish laptop (2GB Ram, 1.9 ghz intel celeron M) Run well on an oldish laptop (with a browswer open) Be able to run on windows Be able to run smoothly on windows Is able to do Java (or, if you really can't find anything, C# will be okay) An extension or something for ...
Multi-domain authentication options for google app engine
6,110,157
0
1
796
0
python,google-app-engine,authentication
Authentication does not imply authorisation. All that the federated ID system does for your application is give you a username/userid that you can trust. So you can setup your user accounts tied to this infomation and rely on the fact that whenever you see that userid you are talking to the same user. Or in the case of...
0
1
0
0
2011-05-24T07:53:00.000
1
0
false
6,107,318
0
0
1
1
I am looking for some suggestions to implement authentication (and authorization) in our GAE app. Assuming that our app is called someapp, our requirement is as follows: someapp is primarily for google apps users of the domain its installed for but can also authenticate users from other google apps domains. For exam...
Google App Engine Locking
6,112,067
2
5
467
0
python,google-app-engine
Instantiating an email object certainly does not count against your "recipients emailed" quota. Like other App Engine services, you consume quota when you trigger an RPC, i.e. call send(). If you intended to email 1500 recipients and App Engine says you emailed 45,000, your code has a bug.
0
1
0
0
2011-05-24T11:21:00.000
2
0.197375
false
6,109,602
0
0
1
2
just wondering if anyone of you has come across this. I'm playing around with the Python mail API on Google App Engine and I created an app that accepts a message body and address via POST, creates an entity in the datastore, then a cron job is run every minute, grabs 200 entities and sends out the emails, then deletes...
Google App Engine Locking
6,141,535
3
5
467
0
python,google-app-engine
Use tasks to send the email. Create a task that takes a key as an argument, retrieves the stored entity for that key, then sends the email. When your handler receives the body and address, store that as you do now but then enqueue a task to do the send and pass the key of your datastore object to the task so it knows w...
0
1
0
0
2011-05-24T11:21:00.000
2
0.291313
false
6,109,602
0
0
1
2
just wondering if anyone of you has come across this. I'm playing around with the Python mail API on Google App Engine and I created an app that accepts a message body and address via POST, creates an entity in the datastore, then a cron job is run every minute, grabs 200 entities and sends out the emails, then deletes...
Problem with reading pasted text in terminal
6,115,447
3
0
121
0
python,terminal
Make sure that your pasted text doesn't contain any embedded control characters (such as a newline), which could end the input.
0
1
0
0
2011-05-24T18:50:00.000
2
0.291313
false
6,115,347
0
0
0
1
I'm reading text in terminal with description = raw_input() It works if I write the text and press enter. The problem is when I paste the text from somewhere with Ctrl+Shift+V or with right click + paste. My program immediately ends, description contains only part of the text (I can see it in database). Do you know how...
Help me decide what to use with Google App Engine for this practical work
6,116,489
4
0
346
0
java,python,google-app-engine
I would recommend using Python + Django framework. I love Java, but for the Google App Engine there is much more documentation online for Python.
0
1
0
0
2011-05-24T20:09:00.000
3
0.26052
false
6,116,236
0
0
1
1
I'm working on a practical work for college, and I have to develop a web-app that could be used by all the teachers from my province. The application should let the users (teachers) manage some information related to their daily duties. One of the requirements is that I must use Google App Engine platform for develop...
How to write a bash script that enters text into programs
6,119,079
2
2
500
0
python,bash
Have you tried echo "Something for input" | python myPythonScript.py ?
0
1
0
0
2011-05-25T02:55:00.000
4
0.099668
false
6,119,038
0
0
0
1
I'm writing a bash script that fires up python and then enters some simple commands before exiting. I've got it firing up python ok, but how do I make the script simulate keyboard input in the python shell, as though a person were doing it?
Interprocess messaging between two Python programs
6,121,275
3
4
1,949
0
python,linux,python-3.x
This really depends on the kind of messaging you want and the roles of the two processes. If it's proper "client/server", I would probably create a SimpleHTTPServer and then use HTTP to communicate between the two. You can also use XMLRPCLib and the client to talk between them. Manually creating a TCP server with your ...
0
1
1
0
2011-05-25T07:49:00.000
3
0.197375
false
6,121,180
0
0
0
1
We have two Python programs running on two linux servers. Now we want to send messages between these Python programs. The best idea so far is to create a TCP/IP server and client architecture, but this seems like a very complicate way to do it. Is this really best practice for doing such a thing?
Python time.time() -> IOError
6,129,347
3
2
757
0
python,linux,gentoo
Did it work before your custom kernel? Boot into a rescue CD, chroot into your gentoo env, and run your script. If it works, it's your kernel. That's about as specific as I can be.
0
1
0
1
2011-05-25T18:26:00.000
2
0.291313
false
6,129,054
0
0
0
1
I've just installed a base gentoo stage 3 and I get the following error when i try and call time.time(): sbx / # python import time Python 2.7.1 (r271:86832, May 22 2011, 14:53:09) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> time.time() Traceback (mo...
Memory Leaks Comet Server in PHP
6,132,278
4
3
254
0
php,python,comet,tornado,long-polling
The gist of it is that PHP was originally written with the intent of having a brand new process for every request that you could just throw away once said request ended, at a time where things like Comet and long polling weren't really on the table. As such there are quite a few areas - notably the garbage collector - ...
0
1
0
1
2011-05-25T22:13:00.000
1
1.2
true
6,131,620
0
0
0
1
Why would a Comet Server like Tornado be especially prone to memory leaks if written in PHP? Are there genuine weaknesses particular to PHP for implementing a long polling framework/service like Tornado? Thanks
Installing JDK and Python and setting the PATH variable on Windows 7
6,147,430
2
1
2,880
0
python,installation,java,windows-7-x64
I'm confused. Are you switching out the paths between the JDK and Python? If that's the case, you can have both paths set in your system's PATH variable. Example: C:\jdk-install\;C:\python-install
0
1
0
0
2011-05-27T02:03:00.000
2
1.2
true
6,147,101
1
0
0
2
I recently installed Java's JDK and Python in my Windows 7 system. I wanted to access both programs from the command line (whether it be cmd or cygwin) so I used the PATH global variable and entered the path to my JDK. What can I do so that python and JDK are accessed by PATH? What I am doing now is changing the PATH v...
Installing JDK and Python and setting the PATH variable on Windows 7
6,147,460
1
1
2,880
0
python,installation,java,windows-7-x64
Right click on "My Computer" Choose "Properties" Click on "Advanced System Settings" Click on "Environment Variables" Find PATH and set it appropriately Note that only processes started after you change the path will see the change.
0
1
0
0
2011-05-27T02:03:00.000
2
0.099668
false
6,147,101
1
0
0
2
I recently installed Java's JDK and Python in my Windows 7 system. I wanted to access both programs from the command line (whether it be cmd or cygwin) so I used the PATH global variable and entered the path to my JDK. What can I do so that python and JDK are accessed by PATH? What I am doing now is changing the PATH v...
Storing Python data on a Linux system
6,147,249
0
2
170
0
python,linux,pickle,data-storage
I'd use a database. A real one. This is why they exist (well, one of the reasons). Don't reinvent the wheel if you don't have to.
0
1
0
0
2011-05-27T02:28:00.000
5
0
false
6,147,225
0
0
0
3
I have the need to create a system to store python data structures on a linux system but have concurrent read and write access to the data from multiple programs/daemons/scripts. My first thought is I would create a unix socket that would listen for connections and serve up requested data as pickled python data struct...
Storing Python data on a Linux system
6,319,111
0
2
170
0
python,linux,pickle,data-storage
You could serialize the data structures and store them as values using ConfigParser. If you created your own access lib/module to the access the data, you could do the serialization in the lib so the client code would just send and receive python objects. You could also handle concurrency in the lib.
0
1
0
0
2011-05-27T02:28:00.000
5
1.2
true
6,147,225
0
0
0
3
I have the need to create a system to store python data structures on a linux system but have concurrent read and write access to the data from multiple programs/daemons/scripts. My first thought is I would create a unix socket that would listen for connections and serve up requested data as pickled python data struct...
Storing Python data on a Linux system
6,147,346
1
2
170
0
python,linux,pickle,data-storage
If you want to just store name/value pairs (e.g. filename to pickled data) you can always use Berkley DB (http://code.activestate.com/recipes/189060-using-berkeley-db-database/). If your data is numbers-oriented, you might want to check out PyTables (http://www.pytables.org/moin). If you really want to use sockets (I w...
0
1
0
0
2011-05-27T02:28:00.000
5
0.039979
false
6,147,225
0
0
0
3
I have the need to create a system to store python data structures on a linux system but have concurrent read and write access to the data from multiple programs/daemons/scripts. My first thought is I would create a unix socket that would listen for connections and serve up requested data as pickled python data struct...
How to upload current date/time into App Engine with Bulkloader tool?
6,153,856
1
1
389
0
python,google-app-engine,bulkloader
I would do this: Add a property to my bulkuploader.yaml for the modified time and use a import transform to get the date?
0
1
0
0
2011-05-27T07:41:00.000
1
1.2
true
6,149,263
0
0
1
1
How can I add a last modified time property to my entity kind that gets updated during a bulk upload? I'm currently using appcfg upload_data to upload a csv up to my high replication datastore. I plan to have this as a cron job to do a one-way sync from our internal database to datastore. In order to account for stale ...
Appengine - Storing a Pickled in Datastore
6,157,563
1
2
853
0
python,google-app-engine,pickle
Never mind. I just ran tests with both. It appears that you cannot use TextProperty with pickle. It will cause errors. Using it with BlobProperty, on the other hand, works perfectly.
0
1
0
0
2011-05-27T20:27:00.000
3
1.2
true
6,157,367
0
0
1
2
In Google Appengine, I'm interested in pickling an object and storing it in the datastore. I don't need to index it. Is there any difference if I store it as a BlobProperty or TextProperty? Which one is better?
Appengine - Storing a Pickled in Datastore
6,157,457
4
2
853
0
python,google-app-engine,pickle
BlobProperty can store binary data while TextProperty can store only strings. You can use BlobProperty as TextProperty is basicly a BlobProperty with encoding.
0
1
0
0
2011-05-27T20:27:00.000
3
0.26052
false
6,157,367
0
0
1
2
In Google Appengine, I'm interested in pickling an object and storing it in the datastore. I don't need to index it. Is there any difference if I store it as a BlobProperty or TextProperty? Which one is better?
Key generation in Google App Engine
6,164,669
1
3
421
0
python,google-app-engine
Keys in App Engine are based on: The keys of the ancestor entities of the entity, if any. The kind name of the entity. Either an auto-generated integer id or a user-assigned key_name. The integer IDs are allocated in generally-increasing blocks to various instances of the application, so that they can be guaranteed to...
0
1
0
0
2011-05-28T04:35:00.000
4
0.049958
false
6,159,666
0
0
1
1
If you guys ever used Google App Engine. It generates a key for every single instance of a model created. It's pretty neat. I'm looking into building something like that. Do they do it so that the key is based on the content? Or do they just take a random choice from a-zA-Z0-9 for like 50 times and build a string out o...
fabric: how to double tunnel
6,161,754
0
18
6,837
0
python,ssh,fabric
I'm just going to answer the SSH part: Yes, you can set up a double tunnel -- one SSH from local to A that tunnels from a secondary local port (like 2121) to port 21 on B, and then you can SSH to localhost:2121 and login on B. I've done stuff like that with PuTTY. Implementing that in fabric is left as an exercise.
0
1
0
0
2011-05-28T12:09:00.000
6
0
false
6,161,548
0
0
0
1
Situation: A and B are remote hosts. Local machine can SSH into A, but not B. B ONLY accepts SSH connections from A. Question: Is it possible to use fabric on the local machine to execute commands on Host B, preferably without having to install fabric on A?
Turn an application or script into a shell command
6,163,126
2
6
3,763
0
python,shell,command-line
Add a shebang: as the top line of the file: #!/usr/bin/python or #!/usr/bin/python3 (you can use the python -B to prevent generation of .pyc files, which is why I don't use /usr/bin/env) Make it executable: You will need to do chmod +x app.py (optional) Add directory to path, so can call it anywhere: Add a directory wi...
0
1
0
0
2011-05-28T17:04:00.000
6
0.066568
false
6,163,087
0
0
0
2
When I want to run my python applications from commandline (under ubuntu) I have to be in the directory where is the source code app.py and run the application with command python app.py How can I make it (how is it conventionally done) to run the application from arbitrary directory with the command: app ? Similarly a...
Turn an application or script into a shell command
6,163,117
0
6
3,763
0
python,shell,command-line
I'm pretty sure you have to make the script executable via chmod +x and put it in the PATH variable of your system.
0
1
0
0
2011-05-28T17:04:00.000
6
0
false
6,163,087
0
0
0
2
When I want to run my python applications from commandline (under ubuntu) I have to be in the directory where is the source code app.py and run the application with command python app.py How can I make it (how is it conventionally done) to run the application from arbitrary directory with the command: app ? Similarly a...
Python setup.py install uses wrong Python installation path
6,168,163
5
3
9,083
0
python,pythonpath
You need to execute setup.py by specifying which python interpreter on the command line, like this: /path/to/python setup.py install UPDATE: The error message indicates that you don't have the python-dev package installed on your system.
0
1
0
0
2011-05-29T13:41:00.000
2
0.462117
false
6,168,035
1
0
0
2
I'm on a bluehost-server which has a "rudimental" installation of python2.6. I installed python2.6 in my user-directory which works fine so far, but when I try to install python packages with "setup.py install", "easy_install" or "pip install" I get: error: invalid Python installation: unable to open /usr/lib/python2.6...
Python setup.py install uses wrong Python installation path
6,169,494
0
3
9,083
0
python,pythonpath
I just solved the problem by installing the needed packages manually, meaning copying the sourcefiles into my local python folder. Thanks for helping anyway. Best Jacques
0
1
0
0
2011-05-29T13:41:00.000
2
0
false
6,168,035
1
0
0
2
I'm on a bluehost-server which has a "rudimental" installation of python2.6. I installed python2.6 in my user-directory which works fine so far, but when I try to install python packages with "setup.py install", "easy_install" or "pip install" I get: error: invalid Python installation: unable to open /usr/lib/python2.6...
python: complexity of os.path.exists with a ext4 filesystem?
6,176,569
0
4
810
0
python,linux,complexity-theory,ext4
Chances are good that the complexity is O(n) with n being the depth in the filesystem (e.g. / would have n=1, /something n=2, ...)
0
1
0
1
2011-05-30T12:55:00.000
2
0
false
6,176,547
1
0
0
1
Does anyone know what the complexity of the os.path.exists function is in python with a ext4 filesystem?
easy_install fails on error "Couldn't find setup script" after binary upload?
39,579,939
1
11
23,071
0
python,binary,easy-install,python-c-extension
Sometimes you don't actually really intend to easy_install the 'directory', which will look for a setup.py file. In simple words, you may be doing easy_install xyz/ while what you really want to do is easy_install xyz
0
1
0
1
2011-05-30T16:29:00.000
3
0.066568
false
6,178,664
0
0
0
1
After uploading a binary distribution of my Python C extension with python setup.py bdist upload, easy_install [my-package-name] fails on "error: Couldn't find a setup script in /tmp/easy_install/package-name-etc-etc". What am I doing wrong?
pydev - can someone please explain these errors
6,187,949
3
1
254
0
python,pydev
Neil speaks the truth, except for telling you to turn it off -- spell check in comments is quite helpful -- those who come after will thank you for ensuring they can read your comments without trying to decode random spelling errors. The lines are simply pointing out words your IDE thinks are spelled wrong. I don't kno...
0
1
0
0
2011-05-31T12:54:00.000
2
1.2
true
6,187,874
1
0
0
2
I am developing using PyDev in Eclipse. I have put in some comments in my code. I get wavy red lines underneath certain words. The program runs fine and there are no warnings mentioned. So what is the meaning of these wavy lines. e.g. #!/usr/bin/python - I get the line under usr and python # generated by accessing re...
pydev - can someone please explain these errors
6,187,969
0
1
254
0
python,pydev
Might be this is just a spellchecker. You have a typo "follwing" instead of "following".
0
1
0
0
2011-05-31T12:54:00.000
2
0
false
6,187,874
1
0
0
2
I am developing using PyDev in Eclipse. I have put in some comments in my code. I get wavy red lines underneath certain words. The program runs fine and there are no warnings mentioned. So what is the meaning of these wavy lines. e.g. #!/usr/bin/python - I get the line under usr and python # generated by accessing re...
Notification as a cron job
6,192,123
1
3
728
0
python,cron
If the cron job runs as "you", and if you set the DISPLAY var (export DISPLAY=:0) you should have no issues.
0
1
0
1
2011-05-31T18:06:00.000
4
0.049958
false
6,191,624
0
0
0
2
I coded a python application which was running OK as a cron job. Later I added some libraries (e.g. pynotify and other *) because I wanted to be notified with the message describing what is happening, but it seems that cron can't run such an application. Do you know some alternative how to run this application every fi...
Notification as a cron job
6,191,715
0
3
728
0
python,cron
I don't see any problem in cron job with pynotify? What is the error you are getting? Can you run your python code separately to check whether your python code is working really well but only fails with cron? Celery is distributed job queue & task manager written in Python but it may be too much for your needs. Supervi...
0
1
0
1
2011-05-31T18:06:00.000
4
0
false
6,191,624
0
0
0
2
I coded a python application which was running OK as a cron job. Later I added some libraries (e.g. pynotify and other *) because I wanted to be notified with the message describing what is happening, but it seems that cron can't run such an application. Do you know some alternative how to run this application every fi...
Develop in python on Linux, test on Windows
6,194,672
1
0
447
0
python,windows,testing,virtualization
Whatever happens, if you're developing for multiple platforms you're going to have to copy from whichever you're developing on to the secondary platform(s), build it and instigate your tests. Your best bet is to automate as much of it as possible (for both environments) and make a build bot which watches for new code ...
0
1
0
0
2011-05-31T23:15:00.000
3
0.066568
false
6,194,618
0
0
0
2
I'm trying to develop a cross-platform library and want to be able to develop code and then quickly test it on both Windows and Linux. I'm not sure if it's even an option or worthwhile testing under Wine (it uses the multiprocessing module, and COM on Windows) but I do have a VM I've been running it under. It's just be...
Develop in python on Linux, test on Windows
6,194,653
2
0
447
0
python,windows,testing,virtualization
Using a DVCS to push the local changes to the server will take you far. You will need a SSH server on the Windows machine, but there are several of those around. You can also use a makefile to direct the pushing and testing, possibly even running the tests remotely depending on what they consist of.
0
1
0
0
2011-05-31T23:15:00.000
3
1.2
true
6,194,618
0
0
0
2
I'm trying to develop a cross-platform library and want to be able to develop code and then quickly test it on both Windows and Linux. I'm not sure if it's even an option or worthwhile testing under Wine (it uses the multiprocessing module, and COM on Windows) but I do have a VM I've been running it under. It's just be...
Where do scheduled python programs "print"?
6,208,294
2
0
109
0
python,crontab
They will be sent to the email address defined at the top of the crontab, or to the crontab's owner by default. See the crontab(5) man page for more details.
0
1
0
1
2011-06-01T22:02:00.000
1
1.2
true
6,208,274
0
0
0
1
If I schedule print "Hello World!"; to run every hour with crontab, where will Hello World! be printed? Is there a log file? If I do it with Java or C instead of Python, will it make any difference? Thanks!
How can I automate antivirus/WSUS patch testing of my Windows driver and binary?
6,208,551
1
5
1,381
0
python,testing,automation,functional-testing,cots
Interesting problem. One thing to avoid is using the antivirus APIs to check to see if your application triggers them. You want a real live deployment of your application, on the expected operating system, with a real live AV install monitoring it. That way you'll trigger the heuristics monitoring as well as the simple...
0
1
0
1
2011-06-01T22:14:00.000
1
1.2
true
6,208,385
0
0
0
1
My (rather small) company develops a popular Windows application, but one thing we've always struggled with is testing - it frequently is only tested by the developers on a system similar to the one they developed it on, and when an update is pushed out to customers, there is a segment of our base that experiences issu...
SVN having credential problems with Jenkins running as SYSTEM
6,209,784
2
4
1,833
0
python,svn,windows-7,credentials,jenkins
Create a new Jenkins job, and use Subversion as the revision control system. Put in the URL of the Subversion repository you want to manipulate in your Python script. Under the URL will appear a link to let you set the login. Click the link and log in. Once you're done, you can delete the job. The whole purpose was to ...
0
1
0
1
2011-06-01T23:34:00.000
1
1.2
true
6,208,922
0
0
0
1
I have Jenkins running a python script that makes some SVN calls, my problem is that Jenkins tries to run this script as SYSTEM user which doesn't seem to have permission to access the SVN. It prompts me for a password for 'SYSTEM' upon my svn call. If I run the python script by itself, I have no problems accessing the...
Will Python open a file before it's finished writing?
6,215,475
7
4
2,987
0
python,linux,file
Typically on Linux, unless you're using locking of some kind, two processes can quite happily have the same file open at once, even for writing. There are three ways of avoiding problems with this: Locking By having the writer apply a lock to the file, it is possible to prevent the reader from reading the file partial...
0
1
0
0
2011-06-02T13:41:00.000
4
1
false
6,215,324
0
0
0
4
I am writing a script that will be polling a directory looking for new files. In this scenario, is it necessary to do some sort of error checking to make sure the files are completely written prior to accessing them? I don't want to work with a file before it has been written completely to disk, but because the info...
Will Python open a file before it's finished writing?
6,229,831
0
4
2,987
0
python,linux,file
Yes it will. I prefer the "file naming convention" and renaming solution described by Donal.
0
1
0
0
2011-06-02T13:41:00.000
4
0
false
6,215,324
0
0
0
4
I am writing a script that will be polling a directory looking for new files. In this scenario, is it necessary to do some sort of error checking to make sure the files are completely written prior to accessing them? I don't want to work with a file before it has been written completely to disk, but because the info...
Will Python open a file before it's finished writing?
6,215,361
4
4
2,987
0
python,linux,file
On Unix, unless the writing application goes out of its way, the file won't be locked and you'll be able to read from it. The reader will, of course, have to be prepared to deal with an incomplete file (bearing in mind that there may be I/O buffering happening on the writer's side). If that's a non-starter, you'll have...
0
1
0
0
2011-06-02T13:41:00.000
4
1.2
true
6,215,324
0
0
0
4
I am writing a script that will be polling a directory looking for new files. In this scenario, is it necessary to do some sort of error checking to make sure the files are completely written prior to accessing them? I don't want to work with a file before it has been written completely to disk, but because the info...
Will Python open a file before it's finished writing?
6,215,461
0
4
2,987
0
python,linux,file
If you have some control over the writing program, have it write the file somewhere else (like the /tmp directory) and then when it's done move it to the directory being watched. If you don't have control of the program doing the writing (and by 'control' I mean 'edit the source code'), you probably won't be able to m...
0
1
0
0
2011-06-02T13:41:00.000
4
0
false
6,215,324
0
0
0
4
I am writing a script that will be polling a directory looking for new files. In this scenario, is it necessary to do some sort of error checking to make sure the files are completely written prior to accessing them? I don't want to work with a file before it has been written completely to disk, but because the info...
How to detect in Iron Python what the script is being called from?
6,218,295
1
0
112
0
.net,mono,ironpython
You could use System.AppDomain.CurrentDomain.GetAssemblies() (assuming you don't use AppDomain isolation, of course) and see if that contains an assembly that would only be preset when your application is running.
0
1
0
1
2011-06-02T16:49:00.000
2
1.2
true
6,217,545
0
0
0
1
I have a ipy script that can be called either from an embedded console in a larger application or directly from the command line and I'm looking for a quick way to determine at run time which has occurred without having to pass an argument to differentiate the events. Additionally the script has to run on both mono/li...
Install python module to non default version of python on Mac
6,220,717
3
8
4,874
0
python,module
If you're installing through setuptools (ie python setup.py), it will install to the lib directory for the python executable you use (unless it's a broken package).
0
1
0
0
2011-06-02T20:54:00.000
3
0.197375
false
6,220,274
1
0
0
1
I have a couple different versions of Python installed on my Mac. The default version is 2.5, so when I install a module it gets installed to 2.5. I need to be able to install some modules to a different version of Python because I am working on projects that use different versions. Any one know how to accomplish this?...
How to backup python dependencies or modules already installed
6,223,955
7
5
7,121
0
python,dependencies,backup
If you have installed the packages with pip (an improved easy_install), you can just do pip freeze > my-reqs.txt to get a list and versions of the installed packages. There is also some option to install using the reqs file, which I can not remember right now. Pip is meant to companion virtualenv, which can be used to ...
0
1
0
0
2011-06-03T05:46:00.000
2
1
false
6,223,426
1
0
0
1
i have installed many python modules plugins and libraries in my centos system. Now i don't want to install each thing again on separate computers. Is there any way i can make the package like rpm or any other thing so that when i install in in new location all the modules, dependencies also gets installed and everytim...
How to install Python 2.7 devel if I have Python 2.7 in a different directory
6,224,291
7
5
3,612
0
python,dependencies,development-environment
Installing Python from source installs the development files in the same prefix.
0
1
0
0
2011-06-03T07:29:00.000
1
1.2
true
6,224,228
1
0
0
1
I have python 2.7 installed in /opt/python2.7. Now i want to install the devel packages for it but could not find it. How can i install it os that goes in python2.7 not for default python2.4
hide scripts in msi installer
6,226,348
0
0
188
0
python,installation,windows-installer
A solution would be temporary files. You can store them in Binary table and use two custom actions: one which extracts them before the installation starts another one which removes them when installation is finished You can extract them in a temporary location, for example the user Temp folder.
0
1
0
0
2011-06-03T10:04:00.000
1
0
false
6,225,631
1
0
0
1
I am creating an python based msi installer. by which I am executing some python scripts while the installer is running. But I dont want to deliver/install these scripts with package just want to hide them in the msi and use while its running. I tried using binary table in the msi for the same but it didn't work. >H...
How to continuously run a Python script on an EC2 server?
6,232,612
40
23
15,157
0
python,amazon-ec2
You have a few options. You can add your script to cron to be run regularly. You can run your script manually, and detach+background it using nohup. You can run a tool such as GNU Screen, and detach your terminal and log out, only to continue where you left off later. I use this a lot. For example: Log in to your ma...
0
1
1
1
2011-06-03T20:53:00.000
3
1.2
true
6,232,564
0
0
0
1
I've setup an Amazon EC2 server. I have a Python script that is supposed to download large amounts of data from the web onto the server. I can run the script from the terminal through ssh, however very often I loose the ssh connection. When I loose the connection, the script stops. Is there a method where I tell the sc...
Battling with wxpython
6,232,781
11
5
662
0
macos,wxpython,32bit-64bit
I don't have a Mac, but I read almost all the messages on the wxPython mailing list. As I understand it, you don't want to use the Python that came with your Mac. It has been modified for the Mac specifically somehow, so you should download a normal version of Python and install it. As for the 32-bit question, with wxP...
1
1
0
0
2011-06-03T20:58:00.000
1
1.2
true
6,232,629
0
0
0
1
I've spent a very frustrating evening trying to get wxpython to work on my MacBook Pro (running Snow Leopard 10.6.6). From reading the various threads on this topic both here and on other websites this is my understanding so far: If you are running python 2.6 or greater you can only work with wxpython if you access th...
Appengine ACL with Google Authentication
6,246,968
5
3
871
0
python,django,google-app-engine,authentication,authorization
You'll need to do this yourself: Implement the ACL with a datastore model keyed by the user's user_id, and fetch and check it on each request. The Users API doesn't provide anything like this built-in.
0
1
0
0
2011-06-04T21:49:00.000
2
1.2
true
6,239,612
0
0
1
1
I would like to implement ACL with Google Authentication. Need some pointer regarding the possibility of the same. Use case: Page X accessible only to myadmin@gmail.com Page Y accessible for all belong to a group Y. After registration a moderator will add/reject the user to the group Y. Pages are not accessible if use...
Ancestors in App Engine data store
6,243,119
5
0
300
0
python,google-app-engine,datastore,ancestor
When you create an entity with a parent, the entities are placed in the same Entity Group. Transactions in App Engine can only work within a single entity group, so if you need transactions, you need entity groups. If you don't need transaction, you don't need entity groups (in particular, to build relationships betwee...
0
1
0
0
2011-06-04T22:19:00.000
1
1.2
true
6,239,737
0
0
1
1
I've been developing for Google App Engine for a while. One of the features I've noticed but haven't had an opportunity to use yet is "ancestors" in the data store. What would be an example of a situation where this is useful?
remotely start Python program in background
6,258,988
2
3
2,313
0
python,fork,shelve,python-daemon
For those who came across this post in the future. Python-daemon can still work. It is just that be sure to load the shelve dicts within the same process. So previously the shelve dicts is loaded in parent process, when python-daemon spawns a child process, the dict handler is not passed correctly. When we fix this, ev...
0
1
0
1
2011-06-05T15:42:00.000
2
0.197375
false
6,243,933
0
0
0
1
I need to use fabfile to remotely start some program in remote boxes from time to time, and get the results. Since the program takes a long while to finish, I wish to make it run in background and so I dont need to wait. So I tried os.fork() to make it work. The problem is that when I ssh to the remote box, and run the...
Binary Files on 32bit / 64bit systems?
6,244,838
2
3
1,348
0
python,serialization,32bit-64bit
As long as your struct format string uses "standard size and alignment" (< or >) rather than "native size and alignment" (@), your files can be used cross-platform.
0
1
0
1
2011-06-05T18:06:00.000
3
1.2
true
6,244,799
0
0
0
1
I am using python struct module to create custom binary files. The file itself has the following format: 4 bytes (integer) 1 byte (unsigned char) 4 bytes (float) 4 bytes (integer) 1 byte (unsigned char) 4 bytes (float) .......................... (100000 such lines) 4 bytes (integer) 1 byte (unsigned char) 4 bytes (fl...
Invoking shell script from a python script using root privileges
6,254,043
1
1
2,685
0
python,linux,shell,root,sudo
I'd put logic in the python_script.py to check its UID and fail if is not executed as root. if os.getuid() != 0:. That will ensure it only runs as root, ether by a root login, or sudo. If you're getting permission denied when trying to execute the python_script.py, you need to set the execute bit on it. chmod +x pyth...
0
1
0
0
2011-06-06T14:34:00.000
1
0.197375
false
6,253,613
0
0
0
1
I'm trying to invoke a shell script shell_script.sh from a python script (python_script.py) using the call command. The shell_script.sh invokes a executable that requires root access to execute. The python_script.py invokes shell_script.sh using subprocess.call(). See below: subprocess.call(['/complete_path/shell_s...
Why does Python's queue.Queue.get() permit returning early from timeouts?
12,251,479
0
4
2,227
0
python,real-time
There is definitely a bug in Queue.get, at least in python 2.6.6. On posix a queue.get(timeout=1) seems to exit (raising the Empty exception) almost immediately, whereas queue.get(timeout=2) is working fine. I was using a single queue with concurrent threads *get*ing on it...
0
1
0
0
2011-06-07T06:15:00.000
3
0
false
6,261,244
0
0
0
2
UPDATE: This question is based on a faulty mental model of how Queue.get() was actually behaving, which was caused by some slightly ambiguous documentation but mainly by a buggy, hand-rolled implementation of timedelta.total_seconds(). I discovered this bug when trying to prove that the original answers where incorrect...
Why does Python's queue.Queue.get() permit returning early from timeouts?
6,261,388
5
4
2,227
0
python,real-time
I think you are misinterpreting the documentation. It isn't saying it might raise the Empty exception after less than timeout seconds, it is saying it will block for at most timeout seconds. It might block for less than that, if it can satisfy the get. I realize you are saying you see it raising Empty early, but hone...
0
1
0
0
2011-06-07T06:15:00.000
3
1.2
true
6,261,244
0
0
0
2
UPDATE: This question is based on a faulty mental model of how Queue.get() was actually behaving, which was caused by some slightly ambiguous documentation but mainly by a buggy, hand-rolled implementation of timedelta.total_seconds(). I discovered this bug when trying to prove that the original answers where incorrect...
How to detect online users in a web application in Google App Engine
6,264,539
2
2
548
0
python,google-app-engine,session
HTTP is stateless, so there's no inherent definition of "online user". You could count the number of non-destroyed sessions you've created, but unless you've got a cron job that destroys old sessions, this won't give an accurate picture. You basically need to decide how much time without a new page request counts as "o...
0
1
0
0
2011-06-07T08:35:00.000
2
0.197375
false
6,262,601
0
0
1
1
I am currently working on an application for Google App Engine, and I need some advice to detect the number of online users in the application. How can I do this? I am using a session library. Do I need to overwrite the session methods (create_session, destroy_session increment/and decrement a value in datastore) or i...
Installed Tornado and Python but Apache is still handling .py files
6,289,549
0
0
847
0
python,apache,webserver,tornado
So you have Apache as the web head and Tornado running behind it? Why not just use ProxyPass from port 80 to whatever port Tornado is running on. You can't get Tornado to serve the .py files like PHP can do with .php files.
0
1
0
1
2011-06-08T09:39:00.000
3
0
false
6,276,805
0
0
0
1
How do I get Tornado (or in general another server) to handle the .py files on my host, while Apache still handles the php files?
Build Cython and gevent on OSX
6,315,275
2
3
1,248
0
python,cython,gevent
Recompilation gevent-1.0dev and greenlet with flags CFLAGS="-arch i386 -arch x86_64" is a solution to my problem.
0
1
0
0
2011-06-08T10:16:00.000
2
1.2
true
6,277,257
1
0
0
1
When I build gevent, I get an error Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.1/bin/cython", line 7, in from Cython.Compiler.Main import main File "/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/Cython-0.14.1-py2.7-macosx-10.4-i386.egg/Cython/Compiler/Main.py", line...
Using PHP/Python to access data from a remote telnet server over SSH
6,283,332
0
0
899
0
php,python,ssh,telnet
Why don't you redirect your stdout to a file. Then use your php website framework to read the file and display the results
0
1
0
1
2011-06-08T17:37:00.000
1
0
false
6,282,891
0
0
0
1
I have a CentOS 5.5 server running a local telnet daemon (which is only accessible from localhost) which prints out a list of active users on our accounting system when sent the correct commands through telnet. I need to make this information available on our intranet website which uses PHP. I've written a Python scri...
Implement time-based quotas in python
6,286,944
1
2
232
0
python,quota
I'm not aware of any ready-made component, but it should be fairly simple to do this. I would probably use a database table, containing two columns: user ID and timestamp. Each time a user (IP address?) wants a connection, you find all the entries with that user ID with a timestamp between now and 60 seconds ago. If it...
0
1
0
0
2011-06-09T00:31:00.000
1
1.2
true
6,286,838
0
0
1
1
I need to implement a time-based quota in my python (twisted) application. Is there an existing module, or other implementation that I should use as a reference? Specifically, my application needs to ratelimit connections from clients, using rules like '10 connections per minute'. There is a Google App Engine module na...
programs paralyzing each other on the server (c++ with openMP and python)
6,289,692
5
1
290
0
c++,python,openmp
There can be a number of reasons for this, for example: Increased failure rate in the branch prediction Exhausted CPU cache Filled up the memory bus Too much context switching (this have an effect on many things, including all the previous points)
0
1
0
1
2011-06-09T07:50:00.000
2
0.462117
false
6,289,668
0
0
0
1
I have an urgent problem because my time is running out: I let my calculations process on a server with 8 cores therefore I'm using openMP in my c++ code and it works fine. Of course I'm not the only one who is using the server, so my capacity is not always 800%CPU. But it happened now several times that someone who s...
What is the difference between an 'sdist' .tar.gz distribution and an python egg?
6,292,860
71
53
21,997
0
python,egg,sdist
setup.py sdist creates a source distribution: it contains setup.py, the source files of your module/script (.py files or .c/.cpp for binary modules), your data files, etc. The result is an archive that can then be used to recompile everything on any platform. setup.py bdist (and bdist_*) creates a built distribution: i...
0
1
0
0
2011-06-09T12:17:00.000
2
1.2
true
6,292,652
1
0
0
1
I am a bit confused. There seem to be two different kind of Python packages, source distributions (setup.py sdist) and egg distributions (setup.py bdist_egg). Both seem to be just archives with the same data, the python source files. One difference is that pip, the most recommended package manager, is not able to insta...
Python distributed application architecture on constrained corporate environment
6,331,843
0
0
381
0
python,architecture,distributed,environment
Answer to myself: I found one possible solution.. I'm lucky because the console.py script is actually invoking many slave python scripts, each of them performing one single system check via standard third-party command-line tools which can be fired to check features on remote hosts. Then, what I did was to modify the g...
0
1
0
0
2011-06-10T14:34:00.000
1
0
false
6,307,829
0
0
0
1
This is my scenario: I developed a Python desktop application which I use to probe the status of services/DBs on the very same machine it is running on. My need is to monitor, using my application, two "brother" Window Server 2003 hosts (Python version is 2.5 for both). One of the hosts lies in my own LAN, the other on...
Deploying Django project on EC2 with BitNami image
6,315,809
3
2
488
0
python,django,deployment,amazon-ec2,amazon-web-services
The answer is pretty obvious. If you start with the Bitnami stack you'll save yourself the hassle of installing and configuring the various components (web server, gateway, python and the required libs, DB, etc.). So if you app is pretty straight forward (typical web app) then sure, start with the bitnami stack. At mos...
0
1
0
0
2011-06-11T11:35:00.000
1
0.53705
false
6,315,654
0
0
1
1
I have a complex university project that requires building some specific libraries and the use of threads (AppEngine out of the question), and I want to deploy in on EC2 (Free tier deal). I was wondering what would be best, to start with a bare linux distribution or the BitNami Django stack ? I've seen similar question...
limits of bulk email in GAE
6,337,957
2
1
196
0
python,google-app-engine,email,backend,task-queue
Enqueue a single task which sends emails sequentially, checking the wallclock time after each email. When the time approaches 10 minutes, chain another task to continue where the current task left off. If you want to send emails faster, parallelize this, and enqueue several tasks that each send emails to a subset of us...
0
1
0
0
2011-06-13T15:30:00.000
1
1.2
true
6,332,562
0
0
1
1
I'm working on a voting app where I need to send an email to each voter to inform him or her about the election. I see three methods for doing this and I'm curious what the approximate limits on the number of emails I could send with each method: In a user request, add a task to a task queue where each task sends one...
GAE expanded log view
6,337,910
1
0
96
0
python,google-app-engine,logging
App Engine stores logging information in a set of circular buffers. When it runs out of space, it overwrites older log entries with the new data. What you're seeing is requests for which the detailed logs have been overwritten by newer requests.
0
1
0
0
2011-06-13T19:24:00.000
1
1.2
true
6,335,248
0
0
1
1
This might not be bug, but feature. I'm having problem views expanded logs when searching logs in dashboard on app engine. Search results show first couple of logs in full detail, but rest of log entries are obscured. Every new entry in log is shown in full details, but older ones get obscured over the time. Same beh...
How to call a python script from Perl?
70,644,949
0
17
31,279
0
python,perl
IF you want to see output in "real time" and not when script has finished running , Add -u after python. example : my $ret = system("python -u pdf2txt.py arg1 arg2");
0
1
0
1
2011-06-14T07:37:00.000
4
0
false
6,340,479
0
0
0
1
I need to call "/usr/bin/pdf2txt.py" with few arguments from my Perl script. How should i do this ?
Python equivalent for curl -b (--cookie)
6,353,057
0
0
262
0
python
You can use CookieJar.add_cookie_header to add your cookie to a http request header.
0
1
0
1
2011-06-15T03:15:00.000
2
0
false
6,352,644
0
0
0
1
I wish to convert a bash script that's currently using "curl -b 'cookie'" into a Python script. I've looked at Pycurl, but I couldnt' find a -b equivalent. There are also urllib and urllib2, but I couldn't see an easy way to replicate the line. Any help would be great.
Shell script replacement?
6,354,008
2
1
509
0
python,shell
Have you thought about using "set -e" if you can depend on the exit status of the programs you're running?
0
1
0
0
2011-06-15T06:37:00.000
5
0.07983
false
6,353,957
0
0
0
2
I'm starting to get sick of shell scripts to perform automations and glue codes between stuff. I love using it for quick and dirty data processing, but even for simple 3 line code that spawns a process and remembers its process id, it's taking me very long time to program it correctly. For every commands, if I don't e...
Shell script replacement?
6,354,023
1
1
509
0
python,shell
What is the question? I don't think many would consider Python 'verbose'. It is brought up often to show how a language can NOT be verbose compared to, say, Java. By the way, Perl, syntactically and historically, can be placed between shell-scripting and Python, I think.
0
1
0
0
2011-06-15T06:37:00.000
5
0.039979
false
6,353,957
0
0
0
2
I'm starting to get sick of shell scripts to perform automations and glue codes between stuff. I love using it for quick and dirty data processing, but even for simple 3 line code that spawns a process and remembers its process id, it's taking me very long time to program it correctly. For every commands, if I don't e...
PyGTK Glade File Manager
6,441,716
0
0
622
0
python,pygtk,glade
I searched GTK API and I found that GTK TreeView does what I want.
1
1
0
0
2011-06-15T10:15:00.000
1
1.2
true
6,356,190
0
0
0
1
I am trying to make a file manager in python that looks like GNOME default file manager (nautilus) Because I am developing a FilePane plugin for a python written text editor. I don't know if there is a widget to give me the same look of Nautilus. If not, what widgets can I use to get a nice looking file manager?
Twisted or Celery? Which is right for my application with lots of SOAP calls?
6,359,524
17
29
5,662
0
python,soap,concurrency,twisted,celery
Is either Celery or Twisted a more generally appropriate framework here? Depends on what you mean by "generally appropriate". If they'll both solve the problem adequately, are there pros/cons to using one vs the other? Not an exhaustive list. Celery Pros: Ready-made distributed task queue, with rate-limiting, re-tr...
0
1
0
0
2011-06-15T12:34:00.000
2
1.2
true
6,357,737
0
0
0
1
I'm writing a Python application that needs both concurrency and asynchronicity. I've had a few recommendations each for Twisted and Celery, but I'm having trouble determining which is the better choice for this application (I have no experience with either). The application (which is not a web app) primarily centers ...
App Engine TimeOut Error: Serving a third-party API with an image stored on App Engine
6,373,752
1
1
494
0
python,image,api,google-app-engine,timeout
If you directly use the App Engine URLfetch API, you can adjust the timeout for your request. The default is 5 seconds, and it can be increased to 10 seconds for normal handlers, or to 10 minutes for fetches within task queue tasks or cron jobs. If the external API is going to take more than 10 seconds to respond, prob...
0
1
0
0
2011-06-16T10:21:00.000
1
1.2
true
6,370,335
0
0
1
1
I'm building an application in Python on App Engine. My application receives images as email attachments. When an email comes in, I grab the image and need to send it to a third party API. The first thing I did was: 1) make a POST request to the third party API with the image data I stopped this method because I had so...
Python KeyboardInterrupt button
6,371,096
7
1
796
0
python,linux,keyboardinterrupt
It's still CtrlC. Or you could send a SIGINT to the process.
0
1
0
0
2011-06-16T11:27:00.000
1
1.2
true
6,371,060
1
0
0
1
I'm using red hat 5 linux, and I would like to know what key combination raises a KeyboardInterrupt exception in python 2.6. I know that it is Ctrl+ c under windows. Regards,
Installing Mechanize using easy_install
6,395,374
0
0
248
0
python,mechanize,easy-install
What's your Python installation location? How did you run easy_install? easy_install probably uses the default user account permissions and you need to manually change file permissions / ownership so that non-admins can see the files. Generally, easy_install is designed for single user installations (development use) ...
0
1
0
0
2011-06-18T06:26:00.000
1
1.2
true
6,394,305
0
0
1
1
I've installed mechanize using easy_install on Windows 7 Admin account. However, when I try to setup/run another program that needs mechanize on a different account, it doesn't find it. Any solutions?
What is the best way to give people your python program
6,396,113
0
2
176
0
python,linux,packaging
If you know a little of C/C++, you could make a tiny C/C++ program which kinda Glues all your python scripts together and packs the Python interpreter with it making a pretty presentable executable. Google "Embedding python scripts into a C/C++ application" and look for the CPython Api reference in your python docs.
0
1
0
0
2011-06-18T11:28:00.000
4
0
false
6,395,657
1
0
0
1
I want to give my python program to some people, and they will run this in Linux. What is the best way to do this ? Is it better to give them every script - I have 5 of them, or make it into an installer like *.deb Thank you.
What's the pythonic way to deal with worker processes that must coordinate their tasks?
6,404,965
2
13
526
0
python,concurrency,multiprocessing
Delegate the retrieval to a separate process which queues the requests until it is their turn.
0
1
0
0
2011-06-19T20:13:00.000
3
1.2
true
6,404,872
1
0
0
2
I'm currently learning Python (from a Java background), and I have a question about something I would have used threads for in Java. My program will use workers to read from some web-service some data periodically. Each worker will call on the web-service at various times periodically. From what I have read, it's prefe...
What's the pythonic way to deal with worker processes that must coordinate their tasks?
6,405,185
2
13
526
0
python,concurrency,multiprocessing
I think that you'll find that the multiprocessing module will provide you with some fairly familiar constructs. You might find that multiprocessing.Queue is useful for connecting your worker threads back to a managing thread that could provide monitoring or throttling.
0
1
0
0
2011-06-19T20:13:00.000
3
0.132549
false
6,404,872
1
0
0
2
I'm currently learning Python (from a Java background), and I have a question about something I would have used threads for in Java. My program will use workers to read from some web-service some data periodically. Each worker will call on the web-service at various times periodically. From what I have read, it's prefe...
Prevent a file descriptor's closure on POSIX systems
6,407,237
1
3
244
0
python,c,unix,posix,system-calls
dup()'d file descriptors are not affected by close() calls of other instances; however, it's possible libvte may be calling some other shutdown methods which do change its state. Use strace to investigate in more detail. Apart from that, there are a few things you can do, but none of them are very pretty. One option wo...
0
1
0
0
2011-06-20T01:10:00.000
2
0.099668
false
6,406,081
0
0
0
1
There is a library (libvte, a terminal emulation library) that uses a pair of file descriptors for a pty master/slave pair. I need to be able to "steal" the master fd from the library for my own use (in order to implement support for ZMODEM for the very rare occasion when the only link I have to the 'net is via a term...
Google App Engine __main__ module
6,418,275
2
1
332
0
python,google-app-engine
each script entry in your app.yaml will be executed as a __main__ module. If you only want a single __main__ then you need to run everything through a single entry-point and map everything via a single WSGIApplication instance.
0
1
0
0
2011-06-20T17:53:00.000
1
1.2
true
6,415,316
0
0
1
1
I'm building a data seeder module that looks for all models using introspection and the inspect module. I index the models I found by a string looking like module.model_name because there might be more modules with the same name in different modules. The problem is that module sometimes is indeed the right module name,...
Python (Portable 2.5) subprocess report problem "WindowsError: [Error 3] The system cannot find the path specified"
6,419,758
0
0
1,217
0
python,subprocess,portability,popen
Can 'cmd /c cmdstr' run correctly on windows?
0
1
0
0
2011-06-20T18:20:00.000
3
0
false
6,415,651
0
0
0
3
I am using python and the codes are all worked well with non-portable version. Since I need to run the program on some computer that does not belong to me, which does not have installed python or such option available. I use portable python instead. However the codes previously works well now report error"WindowsError:...
Python (Portable 2.5) subprocess report problem "WindowsError: [Error 3] The system cannot find the path specified"
6,415,696
1
0
1,217
0
python,subprocess,portability,popen
Ah, the problem is in the cmdStr variable. You must use absolute paths, or else have the user the process is running under have an appropriately setup PATH system variable. That or you have shell=False, which can cause problems in the subprocess module. Check the documentation for issues concerning paths etc.
0
1
0
0
2011-06-20T18:20:00.000
3
0.066568
false
6,415,651
0
0
0
3
I am using python and the codes are all worked well with non-portable version. Since I need to run the program on some computer that does not belong to me, which does not have installed python or such option available. I use portable python instead. However the codes previously works well now report error"WindowsError:...
Python (Portable 2.5) subprocess report problem "WindowsError: [Error 3] The system cannot find the path specified"
6,419,798
0
0
1,217
0
python,subprocess,portability,popen
subprocess.Popen(r"C:\Python27\python.exe",shell=True) can work correctly.
0
1
0
0
2011-06-20T18:20:00.000
3
0
false
6,415,651
0
0
0
3
I am using python and the codes are all worked well with non-portable version. Since I need to run the program on some computer that does not belong to me, which does not have installed python or such option available. I use portable python instead. However the codes previously works well now report error"WindowsError:...
What is NamedTemporaryFile useful for on Windows?
6,416,978
9
3
2,825
0
python,windows
It states that accessing it a second time while it is still open. You can still use the name otherwise, just be sure to pass delete=False when creating the NamedTemporaryFile so that it persists after it is closed.
0
1
0
0
2011-06-20T20:03:00.000
4
1.2
true
6,416,782
1
0
0
3
The Python module tempfile contains both NamedTemporaryFile and TemporaryFile. The documentation for the former says Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later) What is ...
What is NamedTemporaryFile useful for on Windows?
6,416,972
1
3
2,825
0
python,windows
You don't want to "rip out all the bits...". It's coded like that for a reason. It says you can't open it a SECOND time while it's still open. Don't. Just use it once, and throw it away (after all, it is a temporary file). If you want a permanent file, create your own. "Surely this is useful for something, since i...
0
1
0
0
2011-06-20T20:03:00.000
4
0.049958
false
6,416,782
1
0
0
3
The Python module tempfile contains both NamedTemporaryFile and TemporaryFile. The documentation for the former says Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later) What is ...
What is NamedTemporaryFile useful for on Windows?
6,421,756
0
3
2,825
0
python,windows
I'm pretty sure the Python library writers didn't just decide to make NamedTemporaryFile behave differently on Windows for laughs. All those _os.name == 'nt' tests will be there because of platform differences between Windows and Unix. So my inference from that documentation is that on Windows a file opened the way Nam...
0
1
0
0
2011-06-20T20:03:00.000
4
0
false
6,416,782
1
0
0
3
The Python module tempfile contains both NamedTemporaryFile and TemporaryFile. The documentation for the former says Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later) What is ...
How does python process a signal?
6,420,224
6
6
1,742
0
python,signals,extend
If you set a Python code signal handler using the signal module the interpreter will only run it when it re-enters the byte-code interpreter. The handler is not run right away. It is placed in a queue when the signal occurs. If the code path is currently in C code, built-in or extension module, the handler is deferred ...
0
1
0
0
2011-06-21T03:40:00.000
2
1.2
true
6,420,088
0
0
0
1
What is the workflow of processing a signal in python ? I set a signal handler, when the signal occur ,how does python invoke my function? Does the OS invoke it just like C program? If I am in a C extend of python ,is it interrupted immediately ? Now it's clear to me how does python process handle a signal . When you ...
Why thread is slower than subprocess ? when should I use subprocess in place of thread and vise versa
6,422,313
7
4
363
0
python,multithreading,subprocess
Python (or rather CPython, the c-based implementation that is commonly used) has a Global Intepreter Lock (a.k.a. the GIL). Some kind of locking is necessary to synchronize memory access when several threads are accessing the same memory, which is what happens inside a process. Memory is not shared by between process...
0
1
0
0
2011-06-21T08:09:00.000
1
1.2
true
6,422,187
1
0
0
1
In my application, I have tried python threading and subprocess module to open firefox, and I have noticed that subprocess is faster than threading. what could be the reason behind this? when to use them in place of each other?
Program not running correctly from task scheduler
29,738,627
1
1
566
0
python,windows-7
In the Task Scheduler, click Action tag, and then click Edit, by adding the directory of your program in the "Start in (optional):" you get rid of the message ".. is not recognized as an internal or external command, operable program or batch file.'
0
1
0
0
2011-06-21T19:38:00.000
2
0.099668
false
6,431,022
0
0
0
2
We have phone recording software running on a windows 7 box. We run a python script that tells a audio converter program sox, to convert the calls to mp3 format. When we run the script by double clicking it, it works fine. But when we run it through the windows task scheduler, we get the error message. 'Sox is not rec...
Program not running correctly from task scheduler
6,431,263
1
1
566
0
python,windows-7
You should add the program's full path or add the proper directory to your environment's PATH variable.
0
1
0
0
2011-06-21T19:38:00.000
2
0.099668
false
6,431,022
0
0
0
2
We have phone recording software running on a windows 7 box. We run a python script that tells a audio converter program sox, to convert the calls to mp3 format. When we run the script by double clicking it, it works fine. But when we run it through the windows task scheduler, we get the error message. 'Sox is not rec...
How to get around the need for multiple reactors in twisted
6,436,989
0
4
600
0
python,twisted,reactor
Call the Qt message checking/handling functions in the idle event of the Win32 reactor.
0
1
0
0
2011-06-22T08:23:00.000
2
0
false
6,436,935
0
0
0
1
I am running a Qt application on Linux using the qt4reactor The application sends and receives bytes on the serial port. This works very well on Linux with the QtReactor However when I port the application to windows then I have a problem. On windows I use the SerialPort class from _win32SerialPort. The doc string in _...
Python multiprocessing
6,440,883
0
5
2,456
0
python,multicore,multiprocessing
Sounds like a good strategy, but you don't need the multiprocessing module for it, but rather the subprocess module. subprocess is for running child processes from a Python program and interacting with them (stdio, stdout, pipes, etc.), while multiprocessing is more about distributing Python code to run in multiple pro...
0
1
0
0
2011-06-22T13:15:00.000
3
0
false
6,440,474
1
0
0
1
This question is more fact finding and thought process than code oriented. I have many compiled C++ programs that I need to run at different times and with different parameters. I'm looking at using Python multiprocessing to read a job from job queue (rabbitmq) and then feed that job to a C++ program to run (maybe subp...
Making only one task run at a time in celerybeat
6,455,760
0
4
3,061
0
python,celery,celerybeat
You can try adding a classfield to the object that holds the function that youre making run and use that field as a "some other guy is working or not" control
0
1
0
0
2011-06-23T13:45:00.000
4
0
false
6,455,046
0
0
1
1
I have a task which I execute once a minute using celerybeat. It works fine. Sometimes though, the task takes a few seconds more than a minute to run because of which two instances of the task run. This leads to some race conditions that mess things up. I can (and probably should) fix my task to work properly but I wan...
Where does Python look for library binaries?
6,465,119
5
4
917
0
python
Assuming you're on Linux, the OS looks for shared objects in the directories listed in /etc/ld.so.conf, /etc/ld.so.conf.d/* and $LD_LIBRARY_PATH.
0
1
0
0
2011-06-24T08:11:00.000
1
1.2
true
6,465,053
1
0
0
1
I'm trying to bundle a Python library (fontforge) together so that my script runs on a machine without that library installed (but with Python installed). So far I tried copying ".so" files corresponding to "Missing library" errors to current directory, and while it worked for some, it didn't work for others, I'm getti...
Handle server error python
6,467,479
1
0
207
0
python,api,error-handling
The easiest solution will be probably to try to validate the user input before you use it. A simple regular expression which checks the last parts of the domain the user has entered might be enough. If you want to support arbitrary domains without a google\.[a-z]+ or appspot.com suffix you will need another way to figu...
0
1
0
0
2011-06-24T10:54:00.000
2
0.099668
false
6,466,790
0
0
1
1
I m workin on an api where the user enters a domain and i need to redirect to the login page of that domain. So this works for only google domains and i need to handle the error created when user enters non google domain . I m workin on google app engine. I m new to dis error handling.So kindly explain how it works alo...