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
How to make a universal Python application
6,943,765
3
3
860
0
python
Yes. You could build it with Qt for its interface and then you'll have to make judicious use of the os library to make sure that everything plays nicely no matter what operating system it's running on. However when it comes to packaging it for distribution, you'll have to do them separately. For Windows you can use py2exe, which will build a binary package which bundles in the Python runtime and all the libraries you use. I'm not sure how it works in Mac though.
0
1
0
0
2011-08-04T14:50:00.000
5
0.119427
false
6,943,593
1
0
0
3
Can you make a universal python application that will run on both OSX and Windows? With the same menu system, etc? Or would you need to make different versions for each OS?
How to explicitly stop a Google App Engine dynamic backend when the start handler finishes?
7,364,170
0
4
1,017
0
python,google-app-engine,backend
If you configure your backend as a Dynamic backend, then the backend will stop automatically 15 minutes after your "trigger" request is processed. If you don't send that "trigger-to-start" request again in the next 15 minutes, the backend will shutdown automatically. Unfortunately, you'll still have to pay for a minimum of 15 minutes of uptime, even though the backend is idle for those 15 minutes. I'm doing exactly what you're doing in my app - the backend starts, starts leasing tasks from a pull queue, and goes idle when the pull queue is empty. I do this once every hour, so I end up paying for 24/3 = 8 hours of backend uptime everyday. Since this is below the 9 hour quota, I'm happy (for now).
0
1
0
0
2011-08-04T17:07:00.000
2
0
false
6,945,595
0
0
1
2
I have a backend that consumes a queue in its start handler. When the queue is exhausted the start handler will stop. I want the backend to stop when the start handler finishes. I have other code that will send a request to the backend if it adds an item to this queue. These requests merely serve to have GAE start the backend so that it can start consuming the queue. I don't want the backend to ever be in a state where the start handler has finished but the backend remains idle. I want it to stop so that the next request to the backend will cause GAE to start the backend again thus invoking the start handler again and start consuming the queue. How do I accomplish this goal?
How to explicitly stop a Google App Engine dynamic backend when the start handler finishes?
6,978,199
1
4
1,017
0
python,google-app-engine,backend
Backends can't (currently) be started and stopped programmatically. It sounds like what you want, though, is a regular task queue task, which behaves exactly as described.
0
1
0
0
2011-08-04T17:07:00.000
2
0.099668
false
6,945,595
0
0
1
2
I have a backend that consumes a queue in its start handler. When the queue is exhausted the start handler will stop. I want the backend to stop when the start handler finishes. I have other code that will send a request to the backend if it adds an item to this queue. These requests merely serve to have GAE start the backend so that it can start consuming the queue. I don't want the backend to ever be in a state where the start handler has finished but the backend remains idle. I want it to stop so that the next request to the backend will cause GAE to start the backend again thus invoking the start handler again and start consuming the queue. How do I accomplish this goal?
Run wxPython on Lion
8,763,927
1
8
5,631
0
python,wxpython,osx-lion
This may not work for python versions below 2.9. Running 'python' did not work for me...I am using 2.7 for compatibility. But figured out that 'python' may be an alias for a 64 bit mode and for some reason the arch command does not work. So, here is what I have to use under Lion to get wx to work (this works for 2.6 or 2.7): $ arch -i386 python2.7 Then when python loads: import wx works fine. You may have to call the specific python with the arch command, such as python2.7, or whatever version you are using.
1
1
0
0
2011-08-04T18:16:00.000
4
0.049958
false
6,946,503
0
0
0
1
I've just bought a new computer with Lion on it. I've downloaded and installed both Python 2.7 and wxPython 2.8 (for 2.7). I know Python comes with the system, but I rather go with the official one. Anyway, upon typing "import wx" on the IDLE, I get the following message: Traceback (most recent call last): File "", line 1, in import wx File "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/init.py", line 45, in from wx._core import * File "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 4, in import core ImportError: dlopen(/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/core.so, 2): no suitable image found. Did find: /usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/core.so: no matching architecture in universal wrapper I believe it happens because wxPython only supports 32-bit, but I can't figure out how to force python to run on 32-bit. Anyone could help? Thank you in advance.
right way to run some code with timeout in Python
6,948,842
2
32
18,777
0
python,windows,multithreading,timeout
For "normal" Python code, that doesn't linger prolongued times in C extensions or I/O waits, you can achieve your goal by setting a trace function with sys.settrace() that aborts the running code when the timeout is reached. Whether that is sufficient or not depends on how co-operating or malicious the code you run is. If it's well-behaved, a tracing function is sufficient.
0
1
0
0
2011-08-04T18:59:00.000
9
0.044415
false
6,947,065
1
0
0
3
I looked online and found some SO discussing and ActiveState recipes for running some code with a timeout. It looks there are some common approaches: Use thread that run the code, and join it with timeout. If timeout elapsed - kill the thread. This is not directly supported in Python (used private _Thread__stop function) so it is bad practice Use signal.SIGALRM - but this approach not working on Windows! Use subprocess with timeout - but this is too heavy - what if I want to start interruptible task often, I don't want fire process for each! So, what is the right way? I'm not asking about workarounds (eg use Twisted and async IO), but actual way to solve actual problem - I have some function and I want to run it only with some timeout. If timeout elapsed, I want control back. And I want it to work on Linux and Windows.
right way to run some code with timeout in Python
7,036,901
0
32
18,777
0
python,windows,multithreading,timeout
If you're running code that you expect to die after a set time, then you should write it properly so that there aren't any negative effects on shutdown, no matter if its a thread or a subprocess. A command pattern with undo would be useful here. So, it really depends on what the thread is doing when you kill it. If its just crunching numbers who cares if you kill it. If its interacting with the filesystem and you kill it , then maybe you should really rethink your strategy. What is supported in Python when it comes to threads? Daemon threads and joins. Why does python let the main thread exit if you've joined a daemon while its still active? Because its understood that someone using daemon threads will (hopefully) write the code in a way that it wont matter when that thread dies. Giving a timeout to a join and then letting main die, and thus taking any daemon threads with it, is perfectly acceptable in this context.
0
1
0
0
2011-08-04T18:59:00.000
9
0
false
6,947,065
1
0
0
3
I looked online and found some SO discussing and ActiveState recipes for running some code with a timeout. It looks there are some common approaches: Use thread that run the code, and join it with timeout. If timeout elapsed - kill the thread. This is not directly supported in Python (used private _Thread__stop function) so it is bad practice Use signal.SIGALRM - but this approach not working on Windows! Use subprocess with timeout - but this is too heavy - what if I want to start interruptible task often, I don't want fire process for each! So, what is the right way? I'm not asking about workarounds (eg use Twisted and async IO), but actual way to solve actual problem - I have some function and I want to run it only with some timeout. If timeout elapsed, I want control back. And I want it to work on Linux and Windows.
right way to run some code with timeout in Python
7,027,923
10
32
18,777
0
python,windows,multithreading,timeout
A completely general solution to this really, honestly does not exist. You have to use the right solution for a given domain. If you want timeouts for code you fully control, you have to write it to cooperate. Such code has to be able to break up into little chunks in some way, as in an event-driven system. You can also do this by threading if you can ensure nothing will hold a lock too long, but handling locks right is actually pretty hard. If you want timeouts because you're afraid code is out of control (for example, if you're afraid the user will ask your calculator to compute 9**(9**9)), you need to run it in another process. This is the only easy way to sufficiently isolate it. Running it in your event system or even a different thread will not be enough. It is also possible to break things up into little chunks similar to the other solution, but requires very careful handling and usually isn't worth it; in any event, that doesn't allow you to do the same exact thing as just running the Python code.
0
1
0
0
2011-08-04T18:59:00.000
9
1.2
true
6,947,065
1
0
0
3
I looked online and found some SO discussing and ActiveState recipes for running some code with a timeout. It looks there are some common approaches: Use thread that run the code, and join it with timeout. If timeout elapsed - kill the thread. This is not directly supported in Python (used private _Thread__stop function) so it is bad practice Use signal.SIGALRM - but this approach not working on Windows! Use subprocess with timeout - but this is too heavy - what if I want to start interruptible task often, I don't want fire process for each! So, what is the right way? I'm not asking about workarounds (eg use Twisted and async IO), but actual way to solve actual problem - I have some function and I want to run it only with some timeout. If timeout elapsed, I want control back. And I want it to work on Linux and Windows.
Package them all! Perl, python, java for naive users (in windows)
6,950,147
1
1
168
0
java,python,windows,perl,installation
Why don't you try migrating your perl/python code into java and then packagin everything into a nice webstart application? What do perl/python offer that java doesn't support? For perl you can use something like perl2exe and for python py2exe so you can have 2 exes (which would include all the necessary interpreter bits) and invoke them as resources from within java? Or unzip them inside user's home directory and call them again as normal external programs (ProcessBuilder ?) ?
0
1
0
1
2011-08-04T23:44:00.000
2
0.099668
false
6,949,915
1
0
0
1
I have several scripts written in perl, python, and java (wrapped under java GUI with system calls to perl & python). And I have many not-tech-savy users that need to use this in their windows machines (xp & 7). To avoid users from installing perl,python,and java and to avoid potential incompatibility between various versions of these interpreters, I'd like to make a local copy of these interpreters in a folder and then calling them. I'd zip the whole folder (which would also contain my code) and send it away. I'd have to worry about environment variables and make calls to the correct interpreter (especially when other versions of python,java,perl may exists in their current system), but not sure what other problems I may face. Any better ideas? I never used jython and do not know the overhead of moving to it. I also suspect a complex python system, with many files and 3rd party modules will have problems. Same with perl scripts and I don't know a robust perl interpreter callable from java. Thank you, in advance.
Running Scons with two Python installations on Windows
6,953,895
1
0
1,657
0
python,windows,scons
Try to set PYTHONHOME and PYTHONPATH in the scons.bat scripts to the right values for each Python installation respectively.
0
1
0
0
2011-08-05T07:39:00.000
1
1.2
true
6,952,987
1
0
0
1
I have installed two different python versions (3.1 and 2,7) And this is now causing a headache. The default installation is the 3.1 which have the PYTHONHOME and PYTHONPATH set. Problem is that when I try to run scons from the 2.7 installation (via Python27/Scripts/scons.bat) I get various import errors that reference to the Python31/lib/ folder. Are there any good solutions for this, except changing PYTHONHOME and PYTHONPATH for the whole system. Shouldn't scons be able to work with two versions of python installed? Not sure if this is a SuperUser or a SO question, but my guess that most people experienced with Python and Scons hangs here, and not in SU.
GAE TaskQueue: Sample code for accessing pull queue from outside App Engine?
8,681,117
1
2
1,520
0
python,google-app-engine,task-queue
These APIS work only for GAE server since the queues can be created only via queue.yaml and infact API does not expose any API for inserting queue and tasks or project.
0
1
0
0
2011-08-06T07:30:00.000
3
0.066568
false
6,965,431
0
0
1
1
I'm attempting to use GAE TaskQueue's REST API to pull tasks from a queue to an external server (a server not on GAE). Is there a library that does this for me? The API is simple enough, so I just need to figure out authentication. I examined the request sent by gtaskqueue_sample from google-api-python-client using --dump_request and found the authorization: OAuth XXX header. Adding that token to my own requested worked, but the token seems to expire periodically (possibly daily), and I can't figure out how to re-generate it. For that matter, gtaskqueue_sample itself no longer works (the call to https://accounts.google.com/o/oauth2/token fails with No JSON object could be decoded). How does one take care of authentication? This is a server app so ideally I could generate a token that I could use from then on.
AppEngine - When to use a parent relationship?
6,976,575
1
5
276
0
python,google-app-engine,google-cloud-datastore
Everything I read is against Parent entities for one reason, and that is when you modify anything in that tree, everything is locked. When I first started working with parent entities, I wanted to treat them like the head of a hive or a database localized around that parent entry but apparently that isn't the way they are done. You probably want to just use ReferenceProperty because that will allow you access to the parent, and won't cause the locking to go on. Of course, if you are wanting that kind of relationship locking, then maybe you do want it, but you weren't specific enough for me to gauge that.
0
1
0
0
2011-08-07T23:14:00.000
2
0.099668
false
6,976,443
0
0
1
1
I'm trying to understand when to use an entity "parent" on GAE. Is this only useful for querying (ie get all the Foo objects where the parent == someObj) or does the child have access to the parent entity much like a ReferenceProperty? When is it better to use the parent vs ReferenceProperty?
Distributed Celery scheduler
7,013,383
0
13
6,230
0
python,celery
I think there might be some misunderstanding about what celerybeat does. Celerybeat does not process the periodic tasks; it only publishes them. It puts the periodic tasks on the queue to be processed by the celeryd workers. If you run a single celerybeat process and multiple celeryd processes then the task execution will be distributed into the cluster.
0
1
0
0
2011-08-10T13:55:00.000
3
0
false
7,011,950
0
0
0
1
I'm looking for a distributed cron-like framework for Python, and found Celery. However, the docs says "You have to ensure only a single scheduler is running for a schedule at a time, otherwise you would end up with duplicate tasks", Celery is using celery.beat.PersistentScheduler which store the schedule to a local file. So, my question, is there another implementation than the default that can put the schedule "into the cluster" and coordinate task execution so that each task is only run once? My goal is to be able to run celerybeat with identical schedules on all hosts in the cluster. Thanks
why is Python.h in my /usr/local/python2.6 folder when my Mac is using python 2.7?
7,016,498
2
3
1,543
0
python
OK found the answer. You need to install a newer version of Xcode. I had installed an older Xcode 3.2 on Lion. After upgrading, my /usr/include/python2.7 directory was populated with the header files.
0
1
0
1
2011-08-10T18:32:00.000
2
1.2
true
7,015,910
0
0
0
1
I'm running a new mac with osx lion and it came with the latest Python 2.7. My /Library/Frameworks/Python.framework/Versions directory has 2.3, 2.5, 2.6, 2.7, and Current. Now 2.5 and 2.6 have Python.h and many other header files in /include. My problem is I can't find any header files except pyconfig.h in the 2.7/include or Current/include directories. Can anyone shed light on this? EDIT: as Foo Bah pointed out, I should be looking for my header files in /usr/include. So in /usr/include I do not even have a folder python2.7. I have folders for previous version, python2.5 and python2.6. Is there a reason that python2.7 include folder is not there even though the mac came with 2.7?
install pydev without rights to eclipse installation
7,018,120
0
0
94
0
python,eclipse,pydev
The best solution I found was multiple installations: eclipse is not that big (~250mb I think), but it's quite slow, so you'll want to have as little plugins as possible.
0
1
0
0
2011-08-10T21:29:00.000
2
1.2
true
7,018,089
1
0
0
2
My apologies if this has already been asked and answered. I don't know enough about eclipse & pydev setup to know what to search for. I'd like to use pydev, but can't modify the existing installation of eclipse. Do I need to install my own eclipse so that I can then install pydev into it, or is there a way to install pydev off to the side such that I can then use it with the existing eclipse?
install pydev without rights to eclipse installation
7,018,179
0
0
94
0
python,eclipse,pydev
Something that worked quite nicely for me when I was using Pydev with Eclipse as a non-privileged user on a shared computer was to install Eclipse+Pydev on a flash drive. You have the added advantage of being able to work from any computer while having your usual settings.
0
1
0
0
2011-08-10T21:29:00.000
2
0
false
7,018,089
1
0
0
2
My apologies if this has already been asked and answered. I don't know enough about eclipse & pydev setup to know what to search for. I'd like to use pydev, but can't modify the existing installation of eclipse. Do I need to install my own eclipse so that I can then install pydev into it, or is there a way to install pydev off to the side such that I can then use it with the existing eclipse?
PySerial: How to send Ctrl-C command on the serial line
7,018,187
24
17
44,697
0
python,serial-port,copy-paste,pyserial
IIRC, Ctrl-C is etx. Thus send \x03.
0
1
0
1
2011-08-10T21:34:00.000
4
1.2
true
7,018,139
0
0
0
1
I'm automating a configuration process for an embedded board. To enter the setup screen I need to send "Ctrl-C" command. This is NOT to interrupt a process I'm running locally, KeyboardInterrupt will not work. I need to send a value that will be interpreted by the bootloader as Ctrl-C. What is the value I need to send? Thank you
Adding PyDev to Eclipse using the PyDev zip
18,454,032
0
6
11,417
0
python,eclipse,pydev
For whatever it's worth, I was having the same problem running eclipse 3.6 on RHEL 6. When I ran eclipse as myself, I didn't get any PyDev options; however, when I ran eclipse as root, everything showed up. So permissions could be an issue fyi.
0
1
0
1
2011-08-11T01:42:00.000
5
0
false
7,019,933
0
0
0
3
I'm having a lot of trouble getting Eclipse to recognise PyDev when using the PyDev zip file. (I need to use the zip file as the Dev machine does not have internet access). I have Eclipse installed and have downloaded the PyDev zip. I've Googled a fair bit and tried the following based on suggestions I found:- Unzipped the .zip into ECLIPSE/helios/dropins and restarted eclipse. Unzipped the .zip into ECLIPSE/helios/plugins and restarted eclipse. Neither makes Python appear as a selection in the Eclipse, Window, Preferences. Helios contains the executable eclipse file I use to load eclipse. I'm using eclipse in Redhat linux. One suggestion was to extract the zip over the eclipse plugins and features folders, but I don't see how that would work as the zip just produces a heap of files and no folders. Any help to get this working would be great.
Adding PyDev to Eclipse using the PyDev zip
7,020,096
1
6
11,417
0
python,eclipse,pydev
I just did this today and a far easier way to do it is to use the built-in installer. Go to Help -> Install New Software and then type pydev in the software filter. Since you already have the zip, if you extract it in the dropins folder, you'll skip the download portion and go straight to installing it. I have been able to use the zip to install it manually before. I would extract its contents in the eclipse folder overwriting the features and plugins folder. I suggested this to a coworker earlier today and it didn't work for her. She had to download the newest version of eclipse for this method to work. She downloaded the classic version.
0
1
0
1
2011-08-11T01:42:00.000
5
0.039979
false
7,019,933
0
0
0
3
I'm having a lot of trouble getting Eclipse to recognise PyDev when using the PyDev zip file. (I need to use the zip file as the Dev machine does not have internet access). I have Eclipse installed and have downloaded the PyDev zip. I've Googled a fair bit and tried the following based on suggestions I found:- Unzipped the .zip into ECLIPSE/helios/dropins and restarted eclipse. Unzipped the .zip into ECLIPSE/helios/plugins and restarted eclipse. Neither makes Python appear as a selection in the Eclipse, Window, Preferences. Helios contains the executable eclipse file I use to load eclipse. I'm using eclipse in Redhat linux. One suggestion was to extract the zip over the eclipse plugins and features folders, but I don't see how that would work as the zip just produces a heap of files and no folders. Any help to get this working would be great.
Adding PyDev to Eclipse using the PyDev zip
7,033,285
1
6
11,417
0
python,eclipse,pydev
I've been playing with PyDev and Eclipse. Reinstalled Eclipse on a fresh machine and unzipped the standard PyDev over it (not the source version) and it worked fine. Did the same thing on the same machine having the problems but in a different location (/home) also worked fine. So it looks like a configuration problem on the machine not a PyDev/Eclipse issue. Sorry for the run around and thanks for the help. Dog.
0
1
0
1
2011-08-11T01:42:00.000
5
0.039979
false
7,019,933
0
0
0
3
I'm having a lot of trouble getting Eclipse to recognise PyDev when using the PyDev zip file. (I need to use the zip file as the Dev machine does not have internet access). I have Eclipse installed and have downloaded the PyDev zip. I've Googled a fair bit and tried the following based on suggestions I found:- Unzipped the .zip into ECLIPSE/helios/dropins and restarted eclipse. Unzipped the .zip into ECLIPSE/helios/plugins and restarted eclipse. Neither makes Python appear as a selection in the Eclipse, Window, Preferences. Helios contains the executable eclipse file I use to load eclipse. I'm using eclipse in Redhat linux. One suggestion was to extract the zip over the eclipse plugins and features folders, but I don't see how that would work as the zip just produces a heap of files and no folders. Any help to get this working would be great.
Check status of process and restart process if unresponsive/stopped - Python
7,026,127
1
0
1,575
0
python,windows,process,windows-services,operating-system
Naming a process 'unresponsive' is quite subjective. It might be waiting for data and seem unresponsive, or it might be in a (endless) loop and seem unresponsive. Usually, what people do is implement hartbeat. That is - have a very tiny socket server in the process where other processes can connect and send ping messages, to which it replies pong. What monitoring tools usually do is ping the process periodically, and if it doesn't respond within a timeout - it's considered unresponsive (and usually gets killed).
0
1
0
0
2011-08-11T10:55:00.000
1
1.2
true
7,024,626
0
0
0
1
I'm trying to build a small process monitoring script on Windows Server 2008. The script would: find target process check status (running/unresponsive/stopped) kill and restart process if unresponsive/stopped Any suggestion on the best way to implement this?
Porting from platform.popen to subprocess.Popen?
7,027,423
0
1
220
0
python,subprocess
platform.popen has not been deprecated as best as I can tell. However, this is a low-level function that you should not make use of for flexibility and portability reasons. Lots of other process-launching things were deprecated and some removed in Python 3. Many, many attempts at doing this well were made in the history of Python, and subprocess.Popen and its convenience functions are by far the best. After its existence the others became cruft and most of the retained ones are just there to support legacy code. If you're going to port your code to use the subprocess module, don't look for an exact equivalent to what you have been doing, or you will miss out on the ways in which it is better. Read and understand the subprocess documentation and understand the ideas it is using to solve the problem of process-launching better than the older alternatives. How is subprocess.Popen better than the older alternatives? It is secure. Instead of something('shell command here'), we do Popen(['shell', 'command', 'here']). This doesn't launch an unnecessary shell process, which makes it less errorprone and dangerous. Consider if I asked the user for their name to be input. I might write something('foo %s" % name) in the old thing. It should work--if the user gives you the name "Mike", then it becomes a command like foo Mike. But what if the user's name is "Mike Graham"? Then I want foo 'Mike Graham'. So now I always put in the apostrophes, but now what if the user's name is "Mike O'Reilley"? Worse yet, what if his name is "Mike; rm -rf /"? The solution here isn't to try to escape these yourself (which is hard to do right, let alone to do cross-platform), but to pass the arguments directly without bothering with the shell--Popen(['foo', name])`. It is flexible. You can control the input and output fully. It is nonblocking. Popen can run a process concurrently with yours.
0
1
0
0
2011-08-11T12:28:00.000
1
1.2
true
7,025,833
0
0
0
1
I have a bunch of code that uses the old deprecated popen from the platform package. Since this is deprecated, I will be moving this to the subprocess package. What is the equivalent statement to popen("some_command")? Is there a reason that popen was deprecated?
specifiying directory of Python module when calling it from C++
7,031,182
2
4
52
0
c++,python
Python honors PYTHONPATH environmental variable. It is a PATH like environmental variable specifying paths where Python loads modules. Inside .py script PYTHONPATH can be accessed and updated through the sys.path variable. If you can show more source code how you create Python interpreter more helpful answer can be given.
0
1
0
1
2011-08-11T18:38:00.000
1
0.379949
false
7,031,077
0
0
0
1
When trying to to import and execute a function within a Python module from a C++ executable, how can I pass in the directory where the module is located as a command line argument?
Python OpenGL in Eclipse/Aptana
7,036,672
0
1
1,045
0
python,eclipse,opengl,aptana,pydev
Are you sure you don't have multiple versions of python? Seems to me like the interpreter that aptana uses is not the same as the one used from command line. You can look in: Run -> Run configurations -> Python run -- then you have Interpreter tab There you can click : See resulting command line. Than will get you the python that is used as well as the python path
0
1
0
1
2011-08-12T06:54:00.000
3
0
false
7,036,584
0
0
0
3
I am trying to import the OpenGL.GL module. Given the py file with that line, I can perform "python file.py" just fine, but I cannot run that same file when used in Aptana or Eclipse. Both IDEs have PyDev installed. I do have PyOpenGL installed. I wish to point out that I can still import other modules (PIL, numpy), which were installed the same way as the PyOpenGL. I am confident that there is only 1 python running on my MacOS.
Python OpenGL in Eclipse/Aptana
7,041,218
1
1
1,045
0
python,eclipse,opengl,aptana,pydev
Maybe you need to reconfigure your interpreter. If you installed PyOpenGL as an egg after pydev was set up your PYTHONPATH might be out of date. Check out Preferences->PyDev->Interpreter - Python
0
1
0
1
2011-08-12T06:54:00.000
3
0.066568
false
7,036,584
0
0
0
3
I am trying to import the OpenGL.GL module. Given the py file with that line, I can perform "python file.py" just fine, but I cannot run that same file when used in Aptana or Eclipse. Both IDEs have PyDev installed. I do have PyOpenGL installed. I wish to point out that I can still import other modules (PIL, numpy), which were installed the same way as the PyOpenGL. I am confident that there is only 1 python running on my MacOS.
Python OpenGL in Eclipse/Aptana
10,692,265
2
1
1,045
0
python,eclipse,opengl,aptana,pydev
I had the same problem after installing a different version of PyOpen and my Eclipse PyDev path is messed up. What I did was remove the interpreter link and re-added the old one which made PyDev to re-scan my libs. This seems to fix the problem. Don't forget for all your projects, you need to go to the property (Right click project->properties) and re-select the interpreter.
0
1
0
1
2011-08-12T06:54:00.000
3
0.132549
false
7,036,584
0
0
0
3
I am trying to import the OpenGL.GL module. Given the py file with that line, I can perform "python file.py" just fine, but I cannot run that same file when used in Aptana or Eclipse. Both IDEs have PyDev installed. I do have PyOpenGL installed. I wish to point out that I can still import other modules (PIL, numpy), which were installed the same way as the PyOpenGL. I am confident that there is only 1 python running on my MacOS.
This application does not exist (app_id=xxx)
7,063,139
1
24
19,079
0
python,google-app-engine
Tried to upload to the app this morning (first time i've tried since Friday) and it just worked (first time...!) No idea what the issue was as I haven't done any work on this over the weekend so everything should have been the same as it was on Friday.
0
1
0
0
2011-08-12T11:04:00.000
13
0.015383
false
7,039,200
0
0
1
9
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
32,418,665
0
24
19,079
0
python,google-app-engine
Posting Ric Moore's comment in the selected answer because that is a valid answer and it worked in my case (and hopefully it helps someone else having the same issue spot it quickly). I have an alternation solution - in the Google App Engine Launcher select from the menu Control > Clear Deployment Credential. Then when you click Deploy it will take you through the auth flow again and you can select the correct account. - Ric Moore
0
1
0
0
2011-08-12T11:04:00.000
13
0
false
7,039,200
0
0
1
9
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
8,974,660
1
24
19,079
0
python,google-app-engine
I got the same error message trying to make the first deployment of a Python Application using a Google Apps account. In my case the problem was caused by the fact that my 2-way authentication is enabled. With 2-way authentication enabled you need to generate an authentication password in your Google Account Management Application and use it to do the deployments.
0
1
0
0
2011-08-12T11:04:00.000
13
0.015383
false
7,039,200
0
0
1
9
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
26,124,268
1
24
19,079
0
python,google-app-engine
If you are using --oauth2 make sure that you are logged into the correct account when generating the token.
0
1
0
0
2011-08-12T11:04:00.000
13
0.015383
false
7,039,200
0
0
1
9
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
10,004,722
5
24
19,079
0
python,google-app-engine
The same problem occurs with the Java/Eclipse plugin version of App Engine. The 404 happens when you're logged in to the wrong Google account from within the plugin. In that case, look at the bottom-left of Eclipse to see what account you're currently using. Regarding the Python command line updater, if your cookies indicate that you're logged in to a Google account that doesn't have access to the application you're updating, then that would explain why ignoring those cookies by using "appcfg.py update --nocookies" fixes it.
0
1
0
0
2011-08-12T11:04:00.000
13
0.076772
false
7,039,200
0
0
1
9
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
13,440,444
1
24
19,079
0
python,google-app-engine
this way worked: modified the app.yaml to specify the application: some_id python appcfg.py update ../some_application/server/python
0
1
0
0
2011-08-12T11:04:00.000
13
0.015383
false
7,039,200
0
0
1
9
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
13,757,124
4
24
19,079
0
python,google-app-engine
This is really old, so I wouldn't be surprised if this isn't picked up by the poster, but I wanted to ensure that I have a reference for the next time I have the issue. I had this issue. My problem ended up being that I had not invited the user that I was authenticating as to be a developer on the project. In fact I had just created the user and not even logged on yet. I logged on to the google infrastructure as the new user, then added the new user as a developer on the application. I was then able to upload the app.
0
1
0
0
2011-08-12T11:04:00.000
13
0.061461
false
7,039,200
0
0
1
9
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
25,898,433
1
24
19,079
0
python,google-app-engine
I fixed this problem by editing my app.yaml file to have the correct application name. In the app.yaml file where it says 'application:[insert app name here]', I had to change the [insert app name here] part. I'm not sure why the name was wrong, but I do remember toying around with it before while attempting to fix a different bug. The way I figured out the proper name was to go to my applications in my GAE admin console and look to see what the app's name was there. Hope this helps anyone else that runs into this same problem :)
0
1
0
0
2011-08-12T11:04:00.000
13
0.015383
false
7,039,200
0
0
1
9
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
32,109,147
0
24
19,079
0
python,google-app-engine
What worked for me is to use the project id from the google app engine console instead of the project name in app.yaml
0
1
0
0
2011-08-12T11:04:00.000
13
0
false
7,039,200
0
0
1
9
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
How do I get node-waf to install?
7,057,283
3
4
5,062
0
python,node.js,npm,waf
To solve the path problem, I backed up and re-installed Node. To solve the version problem, at the suggestion of some bright soul on the #nodejs channel, I created a symbolic link at ~/bin/python that pointed to the right version (that solved a lot of my own problems too, starting up the wrong version from the command line...) An obvious hack, but when you're frustrated, you overlook the obvious.
0
1
0
1
2011-08-13T15:12:00.000
1
1.2
true
7,051,276
0
0
1
1
First, props to whoever did node.js. I've been using it for less than a day and I'm already thinking about using it for stuff I use Python for now. In fact, whoever did node.js should think about using it for stuff they use Python for now. There is apparently a tool called node-waf that is in Python and is necessary for npm to work and npm of course is necessary for anything else useful. I think that my original install went bad because node-waf (which is in /mnt/michael/bin/node-waf) couldn't find Scripting.py (which is in /mnt/michael/node/tools/wafadmin/; it was looking in non-existent /mnt/michael/node/tools/../lib/node/wafadmin/). So I hacked node-waf to point to the right director and kept going and found a much more serious problem. Turns out node-waf isn't written in "Python", but in Python2.6, which is a perfectly good language, it's the language I use myself, but it isn't the language that the default on the system I use. The system is CentOS, which requires Python2.4 be the Python that the command "python" invokes. Yes, that's foolish on the part of the CentOS people but less foolish than the same mistake on the part of the node-waf people, since they are necessarily subject to the rules of the OS. So, please tell me there's some switch I haven't found yet that say "Use Python2.6". Also, any hints about a proper install would be appreciated.
"python" not recognized as a command
34,164,041
8
101
308,763
0
python,windows
I had the same problem for a long time. I just managed to resolve it. So, you need to select your Path, like the others said above. What I did: Open a command window. Write set path=C:\Python24 (put the location and the version for your python). Now type python, It should work. The annoying part with this is that you have to type it every time you open the CMD. I tried to do the permanent one (with the changes in the Environmental variables) but for me its not working.
0
1
0
0
2011-08-14T01:34:00.000
14
1
false
7,054,424
1
0
0
8
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainframes). However I am guessing that there is some command that I need to execute to define python as a command. Can anyone tell me what that command is? The installer placed Python at C:\Python27\.
"python" not recognized as a command
7,054,429
175
101
308,763
0
python,windows
You need to add the python executable path to your Window's PATH variable. From the desktop, right-click My Computer and click Properties. In the System Properties window, click on the Advanced tab. In the Advanced section, click the Environment Variables button. Highlight the Path variable in the Systems Variable section and click the Edit button. Add the path of your python executable(c:\Python27\). Each different directory is separated with a semicolon. (Note: do not put spaces between elements in the PATH. Your addition to the PATH should read ;c:\Python27 NOT ; C\Python27) Apply the changes. You might need to restart your system, though simply restarting cmd.exe should be sufficient. Launch cmd and try again. It should work.
0
1
0
0
2011-08-14T01:34:00.000
14
1
false
7,054,424
1
0
0
8
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainframes). However I am guessing that there is some command that I need to execute to define python as a command. Can anyone tell me what that command is? The installer placed Python at C:\Python27\.
"python" not recognized as a command
14,403,672
8
101
308,763
0
python,windows
Just another clarification for those starting out. When you add C:\PythonXX to your path, make sure there are NO SPACES between variables e.g. This: SomeOtherDirectory;C:\Python27 Not this: SomeOtherDirectory; C:\Python27 That took me a good 15 minutes of headache to figure out (I'm on windows 7, might be OS dependent). Happy coding.
0
1
0
0
2011-08-14T01:34:00.000
14
1
false
7,054,424
1
0
0
8
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainframes). However I am guessing that there is some command that I need to execute to define python as a command. Can anyone tell me what that command is? The installer placed Python at C:\Python27\.
"python" not recognized as a command
7,054,442
5
101
308,763
0
python,windows
Go to Control Panel / System / "Advanced" tab / Enviromental Variables Find variable called PATH in the lower list, and edit it. Add to the end C:\Python27 Open a new cmd window and try now.
0
1
0
0
2011-08-14T01:34:00.000
14
0.071307
false
7,054,424
1
0
0
8
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainframes). However I am guessing that there is some command that I need to execute to define python as a command. Can anyone tell me what that command is? The installer placed Python at C:\Python27\.
"python" not recognized as a command
23,728,520
0
101
308,763
0
python,windows
Make sure you click on Add python.exe to path during install, and select: "Will be installed on local hard drive" It fixed my problem, hope it helps...
0
1
0
0
2011-08-14T01:34:00.000
14
0
false
7,054,424
1
0
0
8
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainframes). However I am guessing that there is some command that I need to execute to define python as a command. Can anyone tell me what that command is? The installer placed Python at C:\Python27\.
"python" not recognized as a command
57,314,543
5
101
308,763
0
python,windows
emphasis: Remember to always RESTART the CMD WINDOW after setting the PATH environmental variable for it to take effect!
0
1
0
0
2011-08-14T01:34:00.000
14
0.071307
false
7,054,424
1
0
0
8
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainframes). However I am guessing that there is some command that I need to execute to define python as a command. Can anyone tell me what that command is? The installer placed Python at C:\Python27\.
"python" not recognized as a command
65,580,961
0
101
308,763
0
python,windows
Easy. Won't need to get confused but paths and variables and what to click. Just follow my steps: Go to the python installer. Run it. Out of the 3 options choose modify. Check py launcher. Next. Check "Add python to environment variables" Install. Restart the cmd when finished and boom done
0
1
0
0
2011-08-14T01:34:00.000
14
0
false
7,054,424
1
0
0
8
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainframes). However I am guessing that there is some command that I need to execute to define python as a command. Can anyone tell me what that command is? The installer placed Python at C:\Python27\.
"python" not recognized as a command
45,619,442
0
101
308,763
0
python,windows
Another helpful but simple solution might be restarting your computer after doing the download if Python is in the PATH variable. This has been a mistake I usually make when downloading Python onto a new machine. After restarting my machine then Windows will often recognize Python in the PATH variable.
0
1
0
0
2011-08-14T01:34:00.000
14
0
false
7,054,424
1
0
0
8
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainframes). However I am guessing that there is some command that I need to execute to define python as a command. Can anyone tell me what that command is? The installer placed Python at C:\Python27\.
Should I use orbited or gevent for integrating comet functionality into a django app
11,276,439
1
5
1,434
0
python,django,postgresql,comet,gevent
Instead of Apache + X-Sendfile you could use Nginx + X-Accel-Redirect. That way you can run a gevent/wsgi/django server behind Nginx with views that provide long-polling. No need for a separate websockets server. I've used both Apache + X-Sendfile and Nginx + X-Accel-Redirect to serve (access-protected) content on Webfaction without any problems.
0
1
0
0
2011-08-15T13:08:00.000
2
0.099668
false
7,065,283
0
0
1
1
I have been working with Django for some time now and have written several apps on a setup that uses Apache 2 mod_wsgi and a PostgreSQL database on ubuntu. I have aa app that uses xsendfile to serve files from Apache via a Django view, and also allow users to upload files via a form as well. All this working great, but I now want to ramp up the features (and the complexity I am sure) by allowing users to chat and to see when new files have been uploaded without refreshing their browser. As I want this to be scale-able, I don't want to poll continually with AJAX as this is going to get very heavy with large numbers of users. I have read more posts, sites and blogs then I can count on integrating comet functionality into a Django app but there are so many different opinions out there on how to do this that I am now completely confused. Should I be using orbited, gevent, iosocket? Where does Tornado fit into this debate? I want the messages also be stored on the database, so do I need any special configuration to prevent my application blocking when writing to the database? Will running a chat server with Django have any impact on my ability to serve files from Apache?
Using Non-Standard Python Install
7,066,558
1
2
608
0
python,centos
Try specifying the full path to the python executable (i.e. /opt/python27/python) rather than using a bare python command. Alternatively, place /opt/python27/ on your PATH earlier than /usr/local/bin (where the python command is presumably already present, you can check with which python).
0
1
0
0
2011-08-15T14:50:00.000
2
1.2
true
7,066,395
1
0
0
2
I recently attempted to upgrade our Python install on a CentOS server from 2.4.3 to 2.7, however it lists 2.4.3 as the newest stable release. This is a problem because I have a Python program that requires at least 2.7 to run properly. After contacting support they installed Python 2.7 in a separate directory, however I'm not sure how to access this version. Anytime I try to run the python program it uses the 2.4.3 version. I have looked into changing the PythonHome variable, but can't get it to work correctly. Is there anything I can do via the command line or inside the program itself to specify which Python version I want to use?
Using Non-Standard Python Install
7,066,607
2
2
608
0
python,centos
I'd suggest you ask your support team to build a separate RPM for Python2.7 and have it installed in a separate location and not conflicting with the OS version. I've done this before it was great to have a consistent Python released across my RHEL3, 4, and 5 systems. Next, I'd suggest you use the following for your sh-bang (first line) "#!/bin/env python2.7" and then ensure your PATH includes the supplemental Python install path. This way, your script stays the same as you run it on your workstation, with it's own unique path to python2.7, and the production environment as well.
0
1
0
0
2011-08-15T14:50:00.000
2
0.197375
false
7,066,395
1
0
0
2
I recently attempted to upgrade our Python install on a CentOS server from 2.4.3 to 2.7, however it lists 2.4.3 as the newest stable release. This is a problem because I have a Python program that requires at least 2.7 to run properly. After contacting support they installed Python 2.7 in a separate directory, however I'm not sure how to access this version. Anytime I try to run the python program it uses the 2.4.3 version. I have looked into changing the PythonHome variable, but can't get it to work correctly. Is there anything I can do via the command line or inside the program itself to specify which Python version I want to use?
Running python command line interpreter inside PyDev
7,067,352
2
5
7,173
0
python,eclipse,pydev
Yes, check the run configurations. You can add the script as a "Python Run".
0
1
0
1
2011-08-15T15:55:00.000
2
1.2
true
7,067,279
1
0
0
1
In matlab, it is possible to execute a script (ie an m-file) and then manipulate the variables created by the script on the command line. Is it possible to run a .py file on PyDev and consequently, manipulate its variables inside eclipse as is possible in the case of matlab?
App Engine, Python: setting Access-Control-Allow-Origin (or other headers) for static file responses
7,075,300
1
4
692
0
python,google-app-engine
You can't; the only thing you can do is to stream these static files adding the Access-Control-Allow-Origin header to the Response.
0
1
1
0
2011-08-16T07:05:00.000
2
0.099668
false
7,074,662
0
0
1
1
Is there a way to set custom headers of responses to static file requests? E.g. I'd want to set Access-Control-Allow-Origin: * when serving static files.
How can I get the main window's handle in Python?
7,076,325
4
5
4,571
0
python,windows,handle
To investigate this kind of things your best friend is Spy++, that comes with several versions of Visual Studio, if you can get it. According to it, notepad.exe creates three top-level windows: The visible main window, class name "Notepad", overlapped. A hidden, disabled, pop-up window, class name "MSCTFIME UI", caption "M". Another hidden, disabled, pop-up window, class name "IME", caption "Default IME". The two hidden windows are used internally by notepad to implement the IME (Input Method Editor), the GUI to type complex scripts. Many programs create top-level hidden windows for a lot of things. For what you intend, you can ignore them all and use only the visible ones.
0
1
0
0
2011-08-16T09:22:00.000
2
0.379949
false
7,076,056
1
0
0
2
In python, I enumerate top-level windows through EnumWindows, and also I enumerate the processes through EnumProcesses. Then in the python script, I put all the window handles which belongs to the same pid into one list (I did this through GetWindowThreadProcessId). Later I found out something: there are 3 window handles which belong to notepad.exe, but I only open one text file. Why? Besides, I tried to set the text window as the foreground window through SetForegroundWindow, I passed the three window handles to this function, and two work. How could this be ?
How can I get the main window's handle in Python?
7,076,281
5
5
4,571
0
python,windows,handle
Processes sometimes create invisible windows for their own purposes. You should ignore them (use IsWindowVisible function).
0
1
0
0
2011-08-16T09:22:00.000
2
1.2
true
7,076,056
1
0
0
2
In python, I enumerate top-level windows through EnumWindows, and also I enumerate the processes through EnumProcesses. Then in the python script, I put all the window handles which belongs to the same pid into one list (I did this through GetWindowThreadProcessId). Later I found out something: there are 3 window handles which belong to notepad.exe, but I only open one text file. Why? Besides, I tried to set the text window as the foreground window through SetForegroundWindow, I passed the three window handles to this function, and two work. How could this be ?
Real-time operating via Python
24,819,846
23
16
43,212
0
python,real-time
When people talk about real-time computing, what they mean is that the latency from an interrupt (most commonly set off by a timer) to application code handling that interrupt being run, is both small and predictable. This then means that a control process can be run repeatedly at very precise time intervals or, as in your case, external events can be timed very precisely. The variation in latency is usually called "jitter" - 1ms maximum jitter means that an interrupt arriving repeatedly will have a response latency that varies by at most 1ms. "Small" and "predictable" are both relative terms and when people talk about real-time performance they might mean 1μs maximum jitter (people building inverters for power transmission care about this sort of performance, for instance) or they might mean a couple of milliseconds maximum jitter. It all depends on the requirements of the application. At any rate, Python is not likely to be the right tool for this job, for a few reasons: Python runs mostly on desktop operating systems. Desktop operating systems impose a lower limit on the maximum jitter; in the case of Windows, it is several seconds. Multiple-second events don't happen very often, every day or two, and you'd be unlucky to have one coincide with the thing you're trying to measure, but sooner or later it will happen; jitter in the several-hundred-milliseconds region happens more often, perhaps every hour, and jitter in the tens-of-milliseconds region is fairly frequent. The numbers for desktop Linux are probably similar, though you can apply different compile-time options and patch sets to the Linux kernel to improve the situation - Google PREEMPT_RT_FULL. Python's stop-the-world garbage collector makes latency non-deterministic. When Python decides it needs to run the garbage collector, your program gets stopped until it finishes. You may be able to avoid this through careful memory management and carefully setting the garbage collector parameters, but depending on what libraries you are using, you may not, too. Other features of Python's memory management make deterministic latency difficult. Most real-time systems avoid heap allocation (ie C's malloc or C++'s new) because the amount of time they take is not predictable. Python neatly hides this from you, making it very difficult to control latency. Again, using lots of those nice off-the-shelf libraries only makes the situation worse. In the same vein, it is essential that real-time processes have all their memory kept in physical RAM and not paged out to swap. There is no good way of controlling this in Python, especially running on Windows (on Linux you might be able to fit a call to mlockall in somewhere, but any new allocation will upset things). I have a more basic question though. You don't say whether your button is a physical button or one on the screen. If it's one on the screen, the operating system will impose an unpredictable amount of latency between the physical mouse button press and the event arriving at your Python application. How will you account for this? Without a more accurate way of measuring it, how will you even know whether it is there?
0
1
0
0
2011-08-16T14:31:00.000
6
1
false
7,079,864
1
0
0
3
So I am an inexperienced Python coder, with what I have gathered might be a rather complicated need. I am a cognitive scientist and I need precise stimulus display and button press detection. I have been told that the best way to do this is by using real-time operating, but have no idea how to go about this. Ideally, with each trial, the program would operate in real-time, and then once the trial is over, the OS can go back to not being as meticulous. There would be around 56 trials. Might there be a way to code this from my python script? (Then again, all I need to know is when a stimulus is actually displayed. The real-time method would assure me that the stimulus is displayed when I want it to be, a top-down approach. On the other hand, I could take a more bottom-up approach if it is easier to just know to record when the computer actually got a chance to display it.)
Real-time operating via Python
24,266,199
2
16
43,212
0
python,real-time
If you are running the Python code on Linux machine, make the kernel low latency (preemptive). There is a flag for it when you compile the kernel. Make sure that other processes running on the machine are minimum so they do not interrupt the kernel. Assign higher task priority to your Python script.
0
1
0
0
2011-08-16T14:31:00.000
6
0.066568
false
7,079,864
1
0
0
3
So I am an inexperienced Python coder, with what I have gathered might be a rather complicated need. I am a cognitive scientist and I need precise stimulus display and button press detection. I have been told that the best way to do this is by using real-time operating, but have no idea how to go about this. Ideally, with each trial, the program would operate in real-time, and then once the trial is over, the OS can go back to not being as meticulous. There would be around 56 trials. Might there be a way to code this from my python script? (Then again, all I need to know is when a stimulus is actually displayed. The real-time method would assure me that the stimulus is displayed when I want it to be, a top-down approach. On the other hand, I could take a more bottom-up approach if it is easier to just know to record when the computer actually got a chance to display it.)
Real-time operating via Python
59,160,388
1
16
43,212
0
python,real-time
Run the python interpreter on a real time operating system or tweaked linux. Shut down the garbage collector during the experiments and back on afterward. Maybe actively trigger a garbage collection round after the end of an experiment. Additionally, keep in mind that showing an image is not instantaneous. You must synchronize your experiment with your monitor's vertical retrace phase (the pause between transmitting the last line of a frame of the display's content and the first line of the next frame). I would start the timer at the beginning of the vsync phase after transmission of the frame containing whatever candidates are supposed to react to. And one would have to keep in mind that the image is going to be ast least partially visible a bit earlier than that for purposes of getting absolute reaction times as opppsed to just well comparable results with ~ half a frame of offset due to the non-instantaneous appearance of the monitor's contents (~10 ms @ 60Hz).
0
1
0
0
2011-08-16T14:31:00.000
6
0.033321
false
7,079,864
1
0
0
3
So I am an inexperienced Python coder, with what I have gathered might be a rather complicated need. I am a cognitive scientist and I need precise stimulus display and button press detection. I have been told that the best way to do this is by using real-time operating, but have no idea how to go about this. Ideally, with each trial, the program would operate in real-time, and then once the trial is over, the OS can go back to not being as meticulous. There would be around 56 trials. Might there be a way to code this from my python script? (Then again, all I need to know is when a stimulus is actually displayed. The real-time method would assure me that the stimulus is displayed when I want it to be, a top-down approach. On the other hand, I could take a more bottom-up approach if it is easier to just know to record when the computer actually got a chance to display it.)
Twisted threading howto avoid deepcopy
7,087,226
3
6
1,543
0
python,multithreading,twisted,deep-copy
Try operating with the minimum data possible in your worker threads. Pass all data that they need in as arguments and take all of their output as the return value (the value the Deferred fires with) rather than as mutations to the inputs. Then integrate the results into the common data structure in the reactor thread. This lets you reason about the work in isolation and avoid any additional locking (which results in contention, slowing things down in addition to making them more confusing).
0
1
0
0
2011-08-16T18:49:00.000
2
0.291313
false
7,083,427
1
0
0
1
I have a twisted server which does some "long" task for each request so i defer to thread each call. In each request i access a common resource, which gets altered during the process. Each request should start with the original data so i use deepcopy on the common resource (while invoking a lock acquire). It works, BUT i think it's not fast enough. I have the feeling that deepcopy is slowing things a bit. What suggestions do you have when dealing in a threaded twisted server with resources mutation ?
python executable file in windows
7,087,550
3
0
245
0
python,executable
You can't use py2exe on plain Ubuntu. It needs to run from Windows. Right now, py2exe doesn't work well with Wine. Do you not have access to any Windows computers (maybe one of your friends')? You can also get your friends to install Python on their Windows machines and teach them how to run your programs, if you're willing to put in the extra effort.
1
1
0
0
2011-08-17T03:06:00.000
1
1.2
true
7,087,529
0
0
0
1
Okay, I'm completely new to this. I created a python script that imports tkinter. On my Ubuntu, I can execute the program from the terminal program. Till now there is no problem. However, my friends asked if I could deliver the program to them so that they could use it on their PC. They have 0 knowledge of programming and they use Windows -.-. So my question is, how I can create an executable file from Ubuntu so that it can run under Windows? I've already read something about py2exe, but I could not manage installing it. If
Getting output of system commands that use pipes (Python)
7,088,283
0
4
250
0
python,linux,pipe
First of all, for what you're doing, it should be better to generate the string using python directly. Anyway, when using subprocess, the correct way to pipe data from a process to another is by redirecting stdout and/or stderr to a subprocess.PIPE, and feed the new process' stdin with the previous process' stdout.
0
1
0
0
2011-08-17T05:01:00.000
2
0
false
7,088,175
0
0
0
1
I'm trying to generate a random string using this command: strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n'; Works fine, but when I try to do subprocess.call(cmd,shell=True) it just gets stuck on the strings /dev/urandom command and spams my screen with grep: writing output: Broken pipe What's causing this and how do I fix it?
Swig binding for Python using UCS-4
8,785,250
1
4
421
0
python,unicode,swig
This is from the SWIG docs, maybe you have seen this: At this time, SWIG provides limited support for Unicode and wide-character strings (the C wchar_t type). Some languages provide typemaps for wchar_t, but bear in mind these might not be portable across different operating systems. This is a delicate topic that is poorly understood by many programmers and not implemented in a consistent manner across languages. For those scripting languages that provide Unicode support, Unicode strings are often available in an 8-bit representation such as UTF-8 that can be mapped to the char * type (in which case the SWIG interface will probably work). If the program you are wrapping uses Unicode, there is no guarantee that Unicode characters in the target language will use the same internal representation (e.g., UCS-2 vs. UCS-4). You may need to write some special conversion functions. So it sounds like you should map it to char* and then figure out how to manually convert it if necessary. It sounds like it is messy to begin with.
0
1
0
0
2011-08-17T10:00:00.000
1
0.197375
false
7,090,957
0
0
0
1
Does anyone know if there is a way to make SWIG encode strings as UCS-4 for Python? The SWIG documentation states that this may be possible using typemaps, but does not provide any other details or examples. For context, I'm working on extending the Blender 3D software with a set of Python scripts. We need to interface these scripts with a variety of robotics software, we do this using SWIG to compile Python libraries. Blender uses its own Python 3.2 precompiled with the --with-wide-unicode option, so it uses UCS-4 unicode strings. However, by defatult SWIG encodes strings as UCS-2, and so when interfacing with Blender I always get an error along the lines of: "undefined symbol: PyUnicodeUCS2_*".
python/serial broken in OSX lion / launchd
7,096,933
1
0
1,631
0
python,macos,osx-lion,launchd,pyserial
The path you are appending: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages is the site-packages directory for a third-party, non-system Python, possibly installed using a python.org installer, and not that of the Apple-supplied system Python 2.7, which would be: /Library/Python/2.7/site-packages So most likely you are using the python.org Python to install pyserial but are launching the system Python under launchd. Check your shell PATH (echo $PATH), it probably has: /Library/Frameworks/Python.framework/Versions/2.7/bin in it. And try which python. If you want to use the python.org Python with your launchd plist, modify it to use an absolute path to the right Python, for instance: /Library/Frameworks/Python.framework/Versions/2.7/bin/python If you want to install pyserial with the system supplied Python, you can use an absolute path to it when doing the install: /usr/bin/python2.7
0
1
0
1
2011-08-17T13:30:00.000
2
0.099668
false
7,093,689
0
0
0
1
I have a launchd entry that worked with OSX 10.6 but that fails with 10.7. It uses python, and it produces an error whilst trying to import serial. I don't quite understand this, because I've re-downloaded pyserial-2.5 and re-installed it with sudo. (In desperation, I re-installed it for each of the many flavours of python on my machine.) As a test, I can enter python and do import serial without difficulties. Maybe there is a system path that is set up well for an interactive user, that is not set up for launched?? Can anyone suggest how I might diagnose the problem?
Howto Serve Python CLI Application Over SSH
8,927,201
0
5
643
0
python,ssh,twisted
A cheap and posibly very dangerous hack is to put your app as the default shell for a particular user. you need to be very careful though (suggestion chroot it to hell and back) as it might be possible to break out of the app and into the server.
0
1
0
1
2011-08-19T03:12:00.000
3
0
false
7,116,553
0
0
0
1
I'm in the process of writing an application with an Urwid front-end and a MongoDB back-end in python. The ultimate goal is to be able to be able to serve the application over SSH. The application has its own authentication/identity system. I'm not concerned about the overhead of launching a new process for each user, the expected number of concurrent users is low. Since the client does not recall any state information and instead it is all stored in the DB I'm not concerned about sessions as such except for authentication purposes. I was wondering if there are any methods to serving the application as is without having to roll my own socket-server code or re-code the app using Twisted. I honestly don't know how Urwid and Twisted play together. I see that Urwid has a TwistedEventLoop method which purports to use the twisted reactor but I cannot find any example code running an Urwid application over a twisted connection. Examples would be appreciated, even simple ones. I've also looked at ZeroMQ but that seems even more inscrutable than Twisted. In short I explored a number of different libraries which purport to serve applications over tcp, most of them by telnet. And nearly all of them focusing on http. Worst case scenario I expect that I may create an extremely locked down user as a global login and use chrooted SSH sessions. that way each user gets their own chroot/process/client. Yes, I know that's probably a "Very Bad Idea(tm)". But I had to throw it out there as a possibility. I appreciate any constructive feedback. Insults, chides, and arrogance will be scowled at, printed out and spat upon. -CH
In Python, how can I get the file system of a given file path
7,119,780
2
3
5,990
0
python,filesystems,filepath
As df itself opens and parses /etc/mtab, you could either go this way and parse this file as well (an alternative would be /proc/mounts), or you indeed parse the df output.
0
1
0
0
2011-08-19T09:31:00.000
3
0.132549
false
7,119,630
0
0
0
2
In python, given a directory or file path like /usr/local, I need to get the file system where its available. In some systems it could be / (root) itself and in some others it could be /usr. I tried os.statvfs it doesnt help. Do I have to run the df command with the path name and extract the file system from the output? Is there a better solution? Its for linux/unix platforms only. Thanks
In Python, how can I get the file system of a given file path
7,119,758
4
3
5,990
0
python,filesystems,filepath
Use os.stat to obtain device number of the file/directory in question (st_dev field), and then iterate through system mounts (/etc/mtab or /proc/mounts), comparing st_dev of each mount point with this number.
0
1
0
0
2011-08-19T09:31:00.000
3
0.26052
false
7,119,630
0
0
0
2
In python, given a directory or file path like /usr/local, I need to get the file system where its available. In some systems it could be / (root) itself and in some others it could be /usr. I tried os.statvfs it doesnt help. Do I have to run the df command with the path name and extract the file system from the output? Is there a better solution? Its for linux/unix platforms only. Thanks
How to properly install Python on OSX for use with OpenCV?
7,129,002
2
4
7,935
0
python,macos,opencv,homebrew
You need to install the module using your python2.7 installation. Pointing your PYTHONPATH at stuff installed under 2.6 to run under 2.7 is a Bad Idea. Depending on how you want to install it, do something like python2.7 setup.py or easy_install-2.7 opencv to install. fwiw, on OS X the modules are usually installed under /System/Library/Frameworks/Python.framework/ but you should almost never need to know where anything installed in your site packages is physically located; if Python can't find them without help you've installed them wrong.
0
1
0
0
2011-08-20T00:39:00.000
4
0.099668
false
7,128,761
0
1
0
1
I spent the past couple of days trying to get opencv to work with my Python 2.7 install. I kept getting an error saying that opencv module was not found whenever I try "import cv". I then decided to try installing opencv using Macports, but that didn't work. Next, I tried Homebrew, but that didn't work either. Eventually, I discovered I should modify the PYTHONPATH as such: export PYTHONPATH="/usr/local/lib/python2.6/site-packages/:$PYTHONPATH" My problem is that I didn't find /usr/local/lib/python2.*...etc The folder simply doesn't exist So my question is this: How do I properly install Python on OS X Snow Leopard for it to work with opencv? Thanks a lot,
How to get bandwidth quota usage with Google app engine api?
7,142,758
1
0
475
0
java,python,api,google-app-engine
No, but you can get a very close estimate of this by adding up the length of the request headers and body for incoming requests, and the response body and headers for responses.
0
1
0
0
2011-08-20T12:48:00.000
2
0.099668
false
7,131,834
0
0
1
1
I want to know if Google App Engine support using google.appengine.api.quota package to get bandwidth usage, not cpu usage? If so, how to get with Python or Java and print in webpage?
undefined _PyUnicodeUCS4_IsWhitespace in compiled cython+numpy
7,153,215
0
2
2,054
0
python,numpy,cython
well, it goes like this: when running python interpreter and imports the numpy library it tries to load from libpython.so the symbol Python is compiled with (i guess so). this is why it works with the interpreter. so the request for that unicode function doesn't come from numpy - but from Python - so it uses the UCS2 functions it compiled with (probably). but when running the compiled version, and again, it tries to load that function - it can't find it because it searches for a UCS4 version.. i did a small check: grep "_PyUnicode" in libpython, in the first dist, and in the second - and there was the different: one printed UCS4 functions, and the other printed UCS2 functions.. so the "easy" solution here i guess is to compile on my first dist a UCS2 version Python, then setting Cython to compile with UCS2.. i believe that will do the job.
0
1
0
0
2011-08-21T08:44:00.000
1
1.2
true
7,137,275
0
0
0
1
i work on ubuntu 10.04 and used cython to compile my python code. i then tried to copy 2 of my binaries (one with numpy, and one without) to another distribution with supported kernel and etc... the only thing i did which is not so cool is that i used the python that comes with that distribution (2.6), and copy from my ubuntu the numpy libraries. when i exec the one without numpy, it works. when i exec the one with the 'from numpy import ...' i get an error like: undefined symbol: _PyUnicodeUCS4_IsWhitespace. i thought that the numpy just compiled for UCS4 where as the python version in the new dist is UCS2. but for my surprise, when i exec the same python code with the numpy import - as python and not compiled - it works. so basically i can say that if i open 'python' and import numpy libraries it works and i can use them. but if i'm using the compiled version - i get that UCS4 error.. any ideas? (the new dist is not so much in my control and i can't really just compile anything i want on that dist) Thanks.
Set up a python virtualenv with a specific version of Python
9,660,148
4
2
2,418
0
python,virtualenv
Virtualenv lets you specify a python binary to use instead of the default. On your machine, python probably maps to /usr/bin/python, which will be a symlink to /usr/bin/python2.6. If you've got Python 2.5 installed, it will be /usr/bin/python2.5 You can create a virtualenv called envname with virtualenv -p /usr/bin/python2.5 envname
0
1
0
0
2011-08-21T12:23:00.000
2
0.379949
false
7,138,229
1
0
0
1
I am trying to get started with Google App Engine. I have python 2.6 installed in my virtual environment which I wanted to use. But Google App Engine supports python2.5. So I want to set up another python virtual environment with python 2.5. Can you help me how to do exactly that?
wx.TaskBarIcon on Ubuntu 11.04
8,073,276
6
3
1,293
0
python,ubuntu,wxpython,wxwidgets,ubuntu-unity
With Ubuntu Unity desktop environment (i.e. Ubuntu 11.04 or 11.10), you need to "whitelist" your application. There are different ways to do this using the 'gsettings' application from the command line. I had to do this to get programs like Skype showing in the system tray again, not just for my own custom apps that use wxPython.
1
1
0
0
2011-08-22T08:24:00.000
3
1
false
7,144,756
0
0
0
1
There is no tray in Unity under Ubuntu 11.04. How can I make icon appear somewhere in Unity? wx.TaskBarIcon is not appear anywhere. Thanks
Running scripts whose purpose is to change shell variables with subprocess.popen
7,153,372
0
0
176
0
python,windows,popen
if 'script A' get generated by another process, you will either need to change the other process so the output file is in a format that you can source (import) into your python script. or write a parser in python that can digest the vars out of 'Script A' setting them within your python script.
0
1
0
0
2011-08-22T18:56:00.000
3
0
false
7,152,172
0
0
0
1
I have a series of scripts I am automating the calling of in python with subprocess.Popen. Basically, I call script A, then script B, then script C and so forth. Script A sets a bunch of local shell variables, with commands such as set SOME_VARIABLE=SCRIPT_A, set PATH=%SCRIPT_A:/=\;%PATH%. Script B and C then need to have the effects of this. In unix, you would call script A with "source script_a.sh". The effect lasts in the current command window. However, subprocess.Popen effectively launches a new window (kind of). Apparently subprocess.Popen is not the command I want to do this. How would I do it? edit I have tried parsing the file (which is all 'set' statements) and passing them as a dictionary to 'env' in subprocess.Popen, but it doesn't seem to have all worked..
Can I control the architecture (32bit vs 64bit) when building a pyinstaller executable?
10,328,518
15
37
42,223
0
python,windows,usb,32bit-64bit,pyinstaller
Pyinstaller produces a binary depending from the python you used to build it. So if you use python 2.7 64 bit it is not possible, as far as I know, to produce a 32 bit executable. This is because Pyinstaller archives all modules and their dependencies (dlls, pyds etc..) which are 64 bit due to the python install. As already said it is better, because of cross compatibility issues, to build 32-bit binaries. Probably you can specify more your question.
0
1
0
0
2011-08-23T03:02:00.000
3
1
false
7,155,866
1
0
0
2
Short Question Is there any way to control / guarantee the architecture (32bit vs 64bit) when building a pyinstaller executable? Background I migrated from py2exe to pyinstaller because of the lack of 64bit support along with a host of small things that I am having a hard time looking past. So on that note, I would prefer not to go back to it. I have developed two applications using Python 2.7 64bit and am having performance issues when running on them 32 bit machines. The first is a simple wxPython GUI (version 2.9) and connects to a windows DLL file for a USB driver. This one seems pretty "safe" to run as 32 bit because there are no modules which are 64bit only. However this application when running on 32bit Windows XP has horrible performance issues when talking to the USB device. The second application is much larger and I have not attempted to build and run yet because of the fear of architecture issues. This application has a number 64bit only modules (psycopg2 for one) used in it. I would like to stay away from trying to build this if it impossible to run as a 32bit executable. Current Thoughts I feel that this might be possible (if the modules have 32bit support) by running the build.py with Python forced in 32bit mode. Does this make any sense? Update I had several breakthroughs on the first program I was building. It turns out the performance issues was solely based on the speed of the two machines. My dev machine had enough power to poll the USB device fast enough and the much slower test platform (Windows XP) did not. I fixed this issue by modifying the way I polled the USB port. Now that this was fixed, I could run the exe on both systems. A new problem had come up when trying to build the executable as a single file. When running pyinstaller's Build.py, it pulls in all of the required DLL's the app needs to run. This seemed to work great at first, but when I tried to run the single exe that I built on Windows 7 64bit, it would not run on Windows XP because the USB dongle's DLL was not recognized as a valid DLL. In order to get the single exe to run on both systems, I first tried to remove the DLL from the .spec file (which appears to be a python script). It was convenient because I was able to modify the list of includes prior to the build command with ordinary python list modifiers. My hope was that if the DLL was not found in the exe's temp directory it would find it on the system PATH. While this approach might work, I could not get it to run without throwing lots of errors. My second attempt was to build the application on the Windows XP machine (leaving the DLL embedded) in hope that the Win XP DLL would work in Windows 7. Success! This configuration works well; however I do strongly believe that this not the best solution as it depends solely on the older DLL running on a newer OS.
Can I control the architecture (32bit vs 64bit) when building a pyinstaller executable?
8,941,506
9
37
42,223
0
python,windows,usb,32bit-64bit,pyinstaller
If you are building an application and it runs fine on 32-bit Windows, there is no need to create a 64-bit version. Just create a 32-bit version and run it on both architectures. What is what WOW64 is for. If you need to use a library or feature which is 64-bit only, just build a 64-bit version. There is no point in building a 32-bit version if the feature is 64-bit only. The only reason to build a 64-bit and 32-bit version both, is to take advantage of increased address space of 64-bit windows. I.e. if you intend to allocate more than 1 or 2 GB of memory. An example might be an image editing application, or a data manipulation application. Then you can run on 32-bit platforms within the constraints of the platform but edit larger images or larger quantities of data on 64-bit platforms. IOW, for your case follow the suggestion of @Velociraptors and build in 32-bit python if you are building a 32-bit exe.
0
1
0
0
2011-08-23T03:02:00.000
3
1
false
7,155,866
1
0
0
2
Short Question Is there any way to control / guarantee the architecture (32bit vs 64bit) when building a pyinstaller executable? Background I migrated from py2exe to pyinstaller because of the lack of 64bit support along with a host of small things that I am having a hard time looking past. So on that note, I would prefer not to go back to it. I have developed two applications using Python 2.7 64bit and am having performance issues when running on them 32 bit machines. The first is a simple wxPython GUI (version 2.9) and connects to a windows DLL file for a USB driver. This one seems pretty "safe" to run as 32 bit because there are no modules which are 64bit only. However this application when running on 32bit Windows XP has horrible performance issues when talking to the USB device. The second application is much larger and I have not attempted to build and run yet because of the fear of architecture issues. This application has a number 64bit only modules (psycopg2 for one) used in it. I would like to stay away from trying to build this if it impossible to run as a 32bit executable. Current Thoughts I feel that this might be possible (if the modules have 32bit support) by running the build.py with Python forced in 32bit mode. Does this make any sense? Update I had several breakthroughs on the first program I was building. It turns out the performance issues was solely based on the speed of the two machines. My dev machine had enough power to poll the USB device fast enough and the much slower test platform (Windows XP) did not. I fixed this issue by modifying the way I polled the USB port. Now that this was fixed, I could run the exe on both systems. A new problem had come up when trying to build the executable as a single file. When running pyinstaller's Build.py, it pulls in all of the required DLL's the app needs to run. This seemed to work great at first, but when I tried to run the single exe that I built on Windows 7 64bit, it would not run on Windows XP because the USB dongle's DLL was not recognized as a valid DLL. In order to get the single exe to run on both systems, I first tried to remove the DLL from the .spec file (which appears to be a python script). It was convenient because I was able to modify the list of includes prior to the build command with ordinary python list modifiers. My hope was that if the DLL was not found in the exe's temp directory it would find it on the system PATH. While this approach might work, I could not get it to run without throwing lots of errors. My second attempt was to build the application on the Windows XP machine (leaving the DLL embedded) in hope that the Win XP DLL would work in Windows 7. Success! This configuration works well; however I do strongly believe that this not the best solution as it depends solely on the older DLL running on a newer OS.
Monitoring Rsync Progress
22,004,775
6
19
14,767
0
python,progress,rsync
Note the caveat here that even --info=progress2 is not entirely reliable since this is percentage based on the number of files rsync knows about at the time when the progress is being displayed. This is not necessarily the total number of files that needed to be sync'd (for instance, if it discovers a large number of large files in a deeply nested directory). One way to ensure that --info=progress2 doesn't jump back in the progress indication would be to force rsync to scan all the directories recursively before starting the sync (instead of its default behavior of doing an incrementally recursive scan), by also providing the --no-inc-recursive option. Note however that this option will also increase rsync memory usage and run-time.
0
1
0
0
2011-08-23T08:07:00.000
4
1
false
7,157,973
0
0
0
2
I'm trying to write a Python script which will monitor an rsync transfer, and provide a (rough) estimate of percentage progress. For my first attempt, I looked at an rsync --progress command and saw that it prints messages such as: 1614 100% 1.54MB/s 0:00:00 (xfer#5, to-check=4/10) I wrote a parser for such messages, and used the to-check part to produce a percentage progress, here, this would be 60% complete. However, there are two flaws in this: In large transfers, the "numerator" of the to-check fraction doesn't seem to monotonically decrease, so the percentage completeness can jump backwards. Such a message is not printed for all files, meaning that the progress can jump forwards. I've had a look at other alternatives of messages to use, but haven't managed to find anything. Does anyone have any ideas? Thanks in advance!
Monitoring Rsync Progress
7,782,009
9
19
14,767
0
python,progress,rsync
You can disable the incremental recursion with the argument --no-inc-recursive. rsync will do a pre-scan of the entire directory structure, so it knows the total number of files it has to check. This is actually the old way it recursed. Incremental recursion, the current default, was added for speed.
0
1
0
0
2011-08-23T08:07:00.000
4
1
false
7,157,973
0
0
0
2
I'm trying to write a Python script which will monitor an rsync transfer, and provide a (rough) estimate of percentage progress. For my first attempt, I looked at an rsync --progress command and saw that it prints messages such as: 1614 100% 1.54MB/s 0:00:00 (xfer#5, to-check=4/10) I wrote a parser for such messages, and used the to-check part to produce a percentage progress, here, this would be 60% complete. However, there are two flaws in this: In large transfers, the "numerator" of the to-check fraction doesn't seem to monotonically decrease, so the percentage completeness can jump backwards. Such a message is not printed for all files, meaning that the progress can jump forwards. I've had a look at other alternatives of messages to use, but haven't managed to find anything. Does anyone have any ideas? Thanks in advance!
Test speed of two scripts
7,162,876
0
1
327
0
python,performance,bash,testing
At the beginning of each script output the start time and at the end of each script output the end time. Subtract the times and compare. Or use the time command if it is available as others have answered.
0
1
0
1
2011-08-23T14:39:00.000
3
0
false
7,162,812
0
0
0
1
I'd like to test the speed of a bash script and a Python script. How would I get the time it took to run them?
In Python, how do you determine whether the kernel is running in 32-bit or 64-bit mode?
16,995,242
-1
12
8,553
0
python
we can used follow API to detect current is 32bit or 64 bit platform.architecture()[0] '64bit
0
1
0
0
2011-08-23T17:08:00.000
5
-0.039979
false
7,164,843
1
0
0
1
I'm running python 2.6 on Linux, Mac OS, and Windows, and need to determine whether the kernel is running in 32-bit or 64-bit mode. Is there an easy way to do this? I've looked at platform.machine(), but this doesn't work properly on Windows. I've also looked at platform.architecture(), and this doesn't work when running 32-bit python on 64-bit Windows. Note: It looks like python 2.7 has a fix that makes platform.architecture() work correctly. Unfortunately, I need to use python 2.6 (at least for now). (edit: From talking to folks off-line, it sounds like there probably isn't a robust python-only way to make this determination without resorting to evil hacks. I'm just curious what evil hacks folks have used in their projects that use python 2.6. For example, on Windows it may be necessary to look at the PROCESSOR_ARCHITEW6432 environment variable and check for AMD64)
How do you allow a Python script access to mkdir in a protected directory without su access in Linux?
7,166,842
0
2
2,415
0
python,linux,shell,filesystems
You could create a separate command that creates the directory and make it setuid root (or, more safely, setuid or setgid to the owner of the parent directory). Make sure the command can't do anything other than what you want to allow it to do (e.g., don't let it pass its argument to system()). Then invoke that command from your Python script. Of course this will also enable any other process with execute permission on the new command to create subdirectories.
0
1
0
1
2011-08-23T19:34:00.000
5
0
false
7,166,528
0
0
0
4
I'm trying to create a python shell script to create a number of directories in Ubuntu Linux. The main directory I'm trying to create directories in is protected from write access. Is there a way to allow the Python script to be allowed to create directories in there as if it's the root user but not have to run the script through su, since other users might need to run the script but should not have su access?
How do you allow a Python script access to mkdir in a protected directory without su access in Linux?
7,166,747
6
2
2,415
0
python,linux,shell,filesystems
This question is not really related to Python. The Python script is just a process like any other process and needs to have to right permissions to do things. The usual method is to create a group, and make the parent directory g+ws for that group. Then add the appropriate users to that group as a supplemental group.
0
1
0
1
2011-08-23T19:34:00.000
5
1.2
true
7,166,528
0
0
0
4
I'm trying to create a python shell script to create a number of directories in Ubuntu Linux. The main directory I'm trying to create directories in is protected from write access. Is there a way to allow the Python script to be allowed to create directories in there as if it's the root user but not have to run the script through su, since other users might need to run the script but should not have su access?
How do you allow a Python script access to mkdir in a protected directory without su access in Linux?
7,166,771
2
2
2,415
0
python,linux,shell,filesystems
Unfortunately no. A process's permissions in a *nix environment are always less than or equal to the permissions of the person who fires it. This actually makes sense though -- it is a huge security risk to allow processes exceed the user's own abilities. This will require someone who has access to that directory -- either through one of their groups or through sudo. Either way, it will require human interaction on every machine that the script is run on. As far as what is easiest, well, you'll need someone who has that authority to grant it to another user, or simply use sudo directly.
0
1
0
1
2011-08-23T19:34:00.000
5
0.07983
false
7,166,528
0
0
0
4
I'm trying to create a python shell script to create a number of directories in Ubuntu Linux. The main directory I'm trying to create directories in is protected from write access. Is there a way to allow the Python script to be allowed to create directories in there as if it's the root user but not have to run the script through su, since other users might need to run the script but should not have su access?
How do you allow a Python script access to mkdir in a protected directory without su access in Linux?
7,166,564
0
2
2,415
0
python,linux,shell,filesystems
You could add a user just for this task, then give the said user permissions for the directory you want the subdirectories created in and execute the script as the said user. There might be easier solutions but that's what comes to my mind at first glance.
0
1
0
1
2011-08-23T19:34:00.000
5
0
false
7,166,528
0
0
0
4
I'm trying to create a python shell script to create a number of directories in Ubuntu Linux. The main directory I'm trying to create directories in is protected from write access. Is there a way to allow the Python script to be allowed to create directories in there as if it's the root user but not have to run the script through su, since other users might need to run the script but should not have su access?
pymongo + gevent: throw me a banana and just monkey_patch?
7,168,735
2
13
4,465
0
python,mongodb,pymongo,monkeypatching,gevent
On initial inspection it doesn't appear to do any socket operations in the c code so it should be fine (blocking ops should just block the green thread).
0
1
0
1
2011-08-23T20:15:00.000
2
0.197375
false
7,166,998
0
0
0
2
Quickie here that needs more domain expertise on pymongo than I have right now: Are the "right" parts of the pymongo driver written in python for me to call gevent monkey_patch() and successfully alter pymongo's blocking behavior on r/w within gevent "asynchronous" greenlets? If this will require a little more leg work on gevent and pymongo -- but it is feasible -- I would be more than willing to put in the time as long as i can get a little guidance over irc. Thanks! Note: At small scale mongo writes are not a big problem because we are just queuing a write "request" before unblocking. BUT talking to fiorix about his twisted async mongo driver (https://github.com/fiorix/mongo-async-python-driver), even mongo's quick write (requests) can cause problems in asyncronous applications at scale. (And of course, non-blocking reads could cause problems from the start!)
pymongo + gevent: throw me a banana and just monkey_patch?
7,169,174
19
13
4,465
0
python,mongodb,pymongo,monkeypatching,gevent
I have used PyMongo with Gevent and here are a few things you need to watch out for: Instantiate only one pymongo.Connection object, preferrably as a global or module-level variable. This is important because Connection has within itself a pool! Monkey patch everything, or at least BOTH socket and threading. Due to the use of thread locals in Connection, patching socket alone is not enough. Remember to call end_request to return the connection to the pool. The answer to your question is go ahead, PyMongo works just fine with Gevent.
0
1
0
1
2011-08-23T20:15:00.000
2
1.2
true
7,166,998
0
0
0
2
Quickie here that needs more domain expertise on pymongo than I have right now: Are the "right" parts of the pymongo driver written in python for me to call gevent monkey_patch() and successfully alter pymongo's blocking behavior on r/w within gevent "asynchronous" greenlets? If this will require a little more leg work on gevent and pymongo -- but it is feasible -- I would be more than willing to put in the time as long as i can get a little guidance over irc. Thanks! Note: At small scale mongo writes are not a big problem because we are just queuing a write "request" before unblocking. BUT talking to fiorix about his twisted async mongo driver (https://github.com/fiorix/mongo-async-python-driver), even mongo's quick write (requests) can cause problems in asyncronous applications at scale. (And of course, non-blocking reads could cause problems from the start!)
Python - How many Default Modules loaded
7,176,030
0
2
237
0
python,linux,module
Any modules you wish to use from the standard library must be imported before you can use them.
0
1
0
1
2011-08-24T13:06:00.000
3
0
false
7,175,909
1
0
0
1
I need to know, When i run My python over terminal by default how many module are loaded with it which i do not have to import to use, which modules i can directly use ?? My System Env is Ubuntu 11.04 Regards
How do I set the PYTHONPATH on Cygwin?
7,199,304
2
4
15,116
0
python,cygwin,biopython
You wrote "(or everything of it past the ~ directory)". I think you need to use the full directory path. And ~ isn't expanded immediately after a ':', so use $HOME instead: export PYTHONPATH = $PYTHONPATH":$HOME/directory/where/you/put/Biopython" (Note the use of double rather than single quotes so $HOME is expanded.)
0
1
0
0
2011-08-26T01:16:00.000
2
0.197375
false
7,199,082
1
0
0
1
In the Biopython installation instructions, it says that if Biopython doesn't work I'm supposed to do this: export PYTHONPATH = $PYTHONPATH':/directory/where/you/put/Biopython' I tried doing that in Cygwin from the ~ directory using the name of the Biopython directory (or everything of it past the ~ directory), but when I tested it by going into the Python interpreter and typing in From Bio.Seq import Seq It said the module doesn't exist. How do I make it so that I don't have to be in the Biopython directory to be able to import Seq?
Why is bash language often slower than python or ruby?
7,200,742
4
3
635
0
python,ruby,bash,interpreter
bash loads a large number of commands from disk. Most other scripting languages have many more instructions that they run internally. For example, to do a simple computation in bash, you'd use a=`expr 1 + 2` and bash will first load /usr/bin/expr, run that command which writes the result in the output, bash collects the output (the ` quotes) and saves the result in the variable 'a'. That's definitively slow. The advantage of bash is the incredible flexibility though. Each person may have a different set of powerful "instructions". For example, I have a small tool called hex to print out numbers in octal, hexadecimal and decimal all at once. Other languages would not integrate in the way bash does...
0
1
0
1
2011-08-26T06:16:00.000
1
1.2
true
7,200,700
1
0
0
1
I assume it is because of the interpreter's implementation. Can anyone give me a more in-depth answer please? Thanks. Also, I wonder if bash has a garbage collector?
Is there a way to interactively program a Python curses application?
7,241,397
0
15
2,130
0
python,curses
Well, I'm not sure I understand completly what you're trying to do. But what I've understood is this that you want to have a standard python console where you can type your code dynamically. But when you call, for exemple a function, the output of the processing of this function would appear into another terminal? Well... for it to work, I think the architecture to use would be a "client-server". Because a process has an stdout and a stderr, and in a multiprocessing architecture you could use the stderr as the function's output pipe. But the problem is initializing the other terminal that is separated from the main one. (no overlapping inside the same space). If your main program Initialize a Server (on another Python process, because of the nature itself of a server) which sends the output to all client connected to it. This way you could visualize the function's output on several terminal clients and/or another computer able to connect to your server. It is, at my opinion, much easier than trying to use the 'curses' package. But if the only purpose is to gain an insight of your code, I think it's overcomplicated (no added value). You still have the option of dumping the function's output into a text file (log.txt)
0
1
0
0
2011-08-26T18:54:00.000
3
0
false
7,209,285
1
0
0
1
Is there a way to create a second terminal so that all calls to curses functions operate on that, rather than in the existing terminal? I work much faster when I can try things out interactively, so I'd like to be able to run an interactive python interpreter in one terminal and see the curses output in another. As it is, calling initscr() in an interactive window either fails (PyDev) or permanently takes away window refresh from the host (Spyder) or causes weird behavior in the console (IPython). Is it possible to take over a different terminal using setupterm()? If so, where do I get a different TERM string to call it with?
Python+Tornado vs Scala+Lift?
7,286,848
14
12
3,553
0
python,scala,comet,lift,tornado
I think Python and Tornado are a great team, for the following reasons Tornado is really an IOLoop that happens to come with an HTTP implementation that runs on it (and a few helpers). This means that it comes with everything you need to do web development with it. It also means that if you find, down the road, that you need other back end services to help scale your application, tornado is very likely of good use in that area. I've actually written more back end services than front end ones in Tornado (but a coworker has the exact opposite experience with it -- he's more front-end oriented and finds it just as nice to work with). A bit off-topic, but we've also used their template module outside of tornado with great success. The code is very modular and there's almost no interdependence, so reusing its components is a breeze. You can learn it, and know it well, very, very quickly. It would take you all of a day to figure out. It's code is clean and unbelievably well-commented, and it has decent documentation besides. I was able to produce a production service with Tornado 0.2 (ca. 2009) in about a week having never seen it before. The tornado source code is very anti-magic. It's fast, and stable. Under load. I don't know if it's the absolute most blazing fast thing in existence, but in the projects I've used it in, it's taking on some very heavy load, in terms of both number of concurrent users, and in terms of data transfer (high-volume image uploads, for example), and it's been a) completely rock solid in terms of stability, and b) fast enough that I haven't had to consider scaling it horizontally or getting bigger hardware. Python is extremely flexible and adaptable. I use Python regularly for web development using Tornado (and other things too, including Django on occasion). However, I also use it for things completely unrelated to the web services themselves, like sysadmin/automation tasks, reporting & data munging (for example, I write hadoop jobs in Python), and other things, where the standard library modules (os, sys, shutil, itertools, collections, etc) make things blindingly fast to build. I can use Python for just about anything, in just about any environment, whether the output goes over a stream, into a browser, to a fat GUI, or a console. It also has a fantastic community around it of really smart people who are also very friendly. I can't compare it to the scala community, but in comparison with lots of other communities, Python is easily my favorite and has a lot to do with why I became so attached at the hip with it. I'm a polyglot, but if I have a question, I would most like to pose that question to a Python community member :)
0
1
0
0
2011-08-29T08:33:00.000
3
1.2
true
7,227,850
0
0
1
3
I'm looking to start a Google Maps based web application. My initial thoughts are that in the first phase the focus should be on the front-end, and the backend should be easy to write and to prototype, and should aid as much as possible the development of the frontend. There will be no 'classic' pages, just a meebo.com style interface. javascript + jquery. (meaning, very few if none at all static pages). My eye has caught the comet-style , server push paradigm, and I'm really interested in doing some proof of concepts with this. Do you have any recommendations or advantages and disadvantages or any experiences in working with : Python + Tornado vs Scala + Lift ? What other advantages or disadvantages in other areas of a web application might a choice bring? Note : This is for max 2 developers, not a big distributed and changing team. Thanks
Python+Tornado vs Scala+Lift?
7,231,443
6
12
3,553
0
python,scala,comet,lift,tornado
Scala is a substantially cleaner language and enables you to use object-oriented and functional paradigms as you see fit. Python has much more syntactic sugar and embraces the "there is only one way to do it" philosophy. Scala is usually used with IDEs like Eclipse/Idea - although support for vim/emacs also exists, too - and built with SBT. If you are not accustomed to these tools, it might take some effort to set them up the first time. Python is often used with much more lightweight editors. Re-running an updated Python script is easier by default. Lift is really targeted at web applications, enabling Desktop-like responsiveness and behavior. If you're just wanting to create a homepage, there are certainly other frameworks around, which don't make you learn as much as with Lift.
0
1
0
0
2011-08-29T08:33:00.000
3
1
false
7,227,850
0
0
1
3
I'm looking to start a Google Maps based web application. My initial thoughts are that in the first phase the focus should be on the front-end, and the backend should be easy to write and to prototype, and should aid as much as possible the development of the frontend. There will be no 'classic' pages, just a meebo.com style interface. javascript + jquery. (meaning, very few if none at all static pages). My eye has caught the comet-style , server push paradigm, and I'm really interested in doing some proof of concepts with this. Do you have any recommendations or advantages and disadvantages or any experiences in working with : Python + Tornado vs Scala + Lift ? What other advantages or disadvantages in other areas of a web application might a choice bring? Note : This is for max 2 developers, not a big distributed and changing team. Thanks
Python+Tornado vs Scala+Lift?
7,231,067
3
12
3,553
0
python,scala,comet,lift,tornado
I would suggest going with Python for these reasons: 1. Debugging What I find especially useful when writing Python code, is the ability to easily debug ( see the pdb module ), all you need is a command prompt and a text editor to set your breakpoints. With Scala, you will probably have to rely on a IDE to do all your debugging. 2. Easy to learn As for programming language, I don't know what your experiences with either languages are. If you are both Python and Scala beginners, my personal opinion is that you will learn Python faster.
0
1
0
0
2011-08-29T08:33:00.000
3
0.197375
false
7,227,850
0
0
1
3
I'm looking to start a Google Maps based web application. My initial thoughts are that in the first phase the focus should be on the front-end, and the backend should be easy to write and to prototype, and should aid as much as possible the development of the frontend. There will be no 'classic' pages, just a meebo.com style interface. javascript + jquery. (meaning, very few if none at all static pages). My eye has caught the comet-style , server push paradigm, and I'm really interested in doing some proof of concepts with this. Do you have any recommendations or advantages and disadvantages or any experiences in working with : Python + Tornado vs Scala + Lift ? What other advantages or disadvantages in other areas of a web application might a choice bring? Note : This is for max 2 developers, not a big distributed and changing team. Thanks
Where is the python mechanize cache/temp folder? How can I clear it? How can I retrieve files from it?
7,236,208
0
0
341
0
python,mechanize
Mechanize doesn't retrieve images unless you specifically tell it to (on a one by one basis).
0
1
0
1
2011-08-29T12:52:00.000
1
0
false
7,230,327
0
0
0
1
I'm on Ubuntu. I'd like to be able to retrieve images saved in my temp folder, and clear it, at will (or does mechanize not actually read images but rather just html?).
data loss problem of tcp protocol in twisted
7,238,064
4
4
531
0
python,tcp,twisted
This problem is not specific to Twisted. Your protocol must have some acknowledgement that data was received, if you want to know that it was received. The result from send() does not tell you that the data was authoritatively received by the peer; it just says that it was queued by the kernel for transport. From your application's point of view, it really doesn't matter whether the data was queued by Twisted, or by your C runtime, or by your kernel, or an intermediary downstream switch, or the peer's kernel, or whatever. Maybe it's sent, maybe it's not. Put another way, transport.write() takes care of additional buffering that send() doesn't, guaranteeing that it always buffers all of your bytes, whereas send() will only buffer some. You absolutely need to have an application-level acknowledgement message if you care about whether a network peer has seen your data or not.
0
1
1
0
2011-08-30T02:10:00.000
1
1.2
true
7,237,996
0
0
0
1
I wrote a tcp based server with the twisted.internet module. It's a high concurrency environment. I usually send data by the instance of protocol.Protocol, and I got a problem with that. Some of the tcp connections may be closed caused by timeout, and it seems I cannot get any notification so that the data I have written in the closed connection may be lost. And the data loss problem may caused by some other way. Is there any good way to control it? (socket.send could return a state, transport.write seems have no return)
How can I use xml.sax module on an executable made with PyInstaller?
7,305,695
0
0
446
0
python
The executable turned out to be fine. For some reason or the other there's wrong versions of the needed dlls in PATH and the executable ended up trying to use those.
0
1
1
0
2011-08-30T09:36:00.000
2
1.2
true
7,241,240
0
0
0
1
I want to have my application read a document using xml.sax.parse. Things work fine but when I move the executable to a Windows server 2008 machine things break down. I get an SAXReaderNotAvailable exception with "No parsers found" message. The setup I'm using to build the executable is: 64 bit windows 7 Python 2.7.2 32-bit PyInstaller 1.5.1
Process entire files in Hadoop using Python code (preferably in Dumbo)
7,247,519
0
2
334
0
python,hadoop,apache-pig
WholeFileRecordReader means not split the input file? If so, define mapred.min.split.size to a very large value, both mapreduce and Pig will take it.
0
1
0
0
2011-08-30T17:19:00.000
2
0
false
7,247,179
0
0
0
1
It seems a very common use case but so hard to do in Hadoop (it is possible with WholeFileRecordReader class). Is it at all possible in Dumbo or Pig? Does anyone knows a way to process whole files as map tasks using Dumbo or Pig?
getting ProcessId within Python code
7,250,363
0
18
36,362
0
python
You will receive the process ID of the newly created process when you create it. At least, you will if you used fork() (Unix), posix_spawn(), CreateProcess() (Win32) or probably any other reasonable mechanism to create it. If you invoke the "python" binary, the python PID will be the PID of this binary that you invoke. It's not going to create another subprocess for itself (Unless your python code does that).
0
1
0
0
2011-08-30T21:37:00.000
4
0
false
7,250,126
0
0
0
2
I am in Windows and Suppose I have a main python code that calls python interpreter in command line to execute another python script ,say test.py . So test.py is executed as a new process.How can I find the processId for this porcess in Python ? Update: To be more specific , we have os.getpid() in os module. It returns the current process id. If I have a main program that runs Python interpreter to run another script , how can I get the process Id for that executing script ?
getting ProcessId within Python code
16,131,293
0
18
36,362
0
python
Another option is that the process you execute will set a console window title for himself. And the searching process will enumerate all windows, find the relevant window handle by name and use the handle to find PID. It works on windows using ctypes.
0
1
0
0
2011-08-30T21:37:00.000
4
0
false
7,250,126
0
0
0
2
I am in Windows and Suppose I have a main python code that calls python interpreter in command line to execute another python script ,say test.py . So test.py is executed as a new process.How can I find the processId for this porcess in Python ? Update: To be more specific , we have os.getpid() in os module. It returns the current process id. If I have a main program that runs Python interpreter to run another script , how can I get the process Id for that executing script ?
How to add .xml extension to all files in a folder in Unix/Linux
7,253,246
2
11
13,442
0
php,python,linux,shell,unix
In Python: Use os.listdir to find names of all files in a directory. If you need to recursively find all files in sub-directories as well, use os.walk instead. Its API is more complex than os.listdir but it provides powerful ways to recursively walk directories. Then use os.rename to rename the files.
0
1
1
1
2011-08-31T06:11:00.000
4
0.099668
false
7,253,198
0
0
0
1
I want to rename all files in a folder and add a .xml extension. I am using Unix. How can I do that?
How to make Eclipse (pydev) automatically fold all comments when opening a file?
13,308,297
6
5
2,092
0
python,eclipse,pydev,folding
By default the loop and condition folds are disabled, to enable them go to Window -> Preferences -> PyDev -> Editor -> Code Folding. Apply code folding to all entries
0
1
0
0
2011-08-31T08:24:00.000
2
1
false
7,254,377
1
0
0
1
Is there a way that eclipse (edit: under windows) folds all comments and docstrings automatically when I open a python file?
Running a Python script saved on a Windows 7 server... on a Mac?
7,261,504
0
0
231
0
python,macos,windows-7
actually the issue is that windows has no equivalent of the execute bit for files. the solution is to change the mount options on the share so that all the files have their execute bit set.
0
1
0
0
2011-08-31T17:54:00.000
2
0
false
7,261,242
0
0
0
1
We have a server running Windows 7 Pro. I have several Python script I'd like to save to the server and have it so that client computers can run them by simply double-clicking. The client computers are all running OSX. This is proving to be... problematic. First I tried to simply make the Python scripts executable, but this doesn't seem to be possible on a Windows server -- since you can't set the 'executable' flag, double-clicking on a file will always open it in an editor (unless I were to go to every single computer and make .py files open with Python). Trying to create a shell script has the same problem -- there's no way to make them executable from the server. My solution was to just make a simple AppleScript app that sends a command to launch the script. Unfortunately, as soon as I copy the app to the server, it stops working. It seems that OSX apps refuse to execute properly when saved to the server -- if you run the file, nothing happens at all. Is there a simple solution I'm overlooking?
Mercurial plugin for Eclipse can't find Python--how to fix?
7,278,773
3
1
1,116
0
python,mercurial,eclipse-plugin,osx-lion
Nobody answered me, but I figured out the answer. Maybe it will help someone. I finally realized that since 'hg -y debuginstall' at the command line was giving me the same error message, it wasn't an Eclipse problem at all (duh). Reinstalling a newer version of Mercurial solved the problem.
0
1
0
1
2011-08-31T18:12:00.000
2
0.291313
false
7,261,451
0
0
1
2
I'm on Mac OS X 10.7.1 (Lion). I just downloaded a fresh copy of Eclipse IDE for Java EE Developers, and installed the Mercurial plugin. I get the following error message: abort: couldn't find mercurial libraries in [...assorted Python directories...]. I do have Python 2.6.1 and 3.2.1 installed. I also have a directory System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7, which is on the list of places it looked for the Mercurial libraries. hg -y debuginstall gives me the same message. What are these libraries named, where is Eclipse likely to have put them when I installed the plugin, and how do I tell Eclipse where they are (or where should I move them to)? Thanks, Dave Full error message follows: abort: couldn't find mercurial libraries in [/usr/platlib/Library/Python/2.6/site-packages /usr/local/bin /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC /Library/Python/2.7/site-packages] (check your install and PYTHONPATH)
Mercurial plugin for Eclipse can't find Python--how to fix?
12,130,976
0
1
1,116
0
python,mercurial,eclipse-plugin,osx-lion
I had two installation of mercurial in mac. One was installed directly and another using macport. Removing the direct installation solved the problem. Remove the direct installation using easy_install -m mercurial Update "Mercurial Executable" path to "/opt/local/bin/hg" Eclipse->Preference->Team->Mercurial-> Restart eclipse
0
1
0
1
2011-08-31T18:12:00.000
2
0
false
7,261,451
0
0
1
2
I'm on Mac OS X 10.7.1 (Lion). I just downloaded a fresh copy of Eclipse IDE for Java EE Developers, and installed the Mercurial plugin. I get the following error message: abort: couldn't find mercurial libraries in [...assorted Python directories...]. I do have Python 2.6.1 and 3.2.1 installed. I also have a directory System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7, which is on the list of places it looked for the Mercurial libraries. hg -y debuginstall gives me the same message. What are these libraries named, where is Eclipse likely to have put them when I installed the plugin, and how do I tell Eclipse where they are (or where should I move them to)? Thanks, Dave Full error message follows: abort: couldn't find mercurial libraries in [/usr/platlib/Library/Python/2.6/site-packages /usr/local/bin /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC /Library/Python/2.7/site-packages] (check your install and PYTHONPATH)
How to run a Python script from another Python script in the cross-platform way?
7,262,679
1
1
3,446
0
python,blender
Two options: Use py2exe to bundle the interpreter with the scripts. Import the modules and call the functions automatically.
0
1
0
0
2011-08-31T19:51:00.000
3
0.066568
false
7,262,604
0
0
0
1
Here is the problem... I'm writing very small plugin for Blender, I have 10 python scripts, they parsing different file formats by using command-line, and I have a Main Python script to run all other scripts with proper commands... for example, "Main.py" include: txt2cfg.py -inFile -outFile... ma2lxo.py -inFile -outFile... Blender already include Python, so I can run "Main.py" from Blender, But I need it to work with both PC and MAC, and also doesn't require Python installation, so I can't use: execfile(' txt2cfg.py -inFile -outFile ') os.system(' ma2lxo.py -inFile -outFile ') or even import subprocess because they required Python installation in order to run *.py files. Sorry for language Thanks
How to debug python scripts that fork
7,272,926
-17
5
2,992
0
python,debugging,fork
But I'm still curious if there's any similar feature in python debugger. I happen to find this feature in perldb and I find it's very handy No. You don't need it. No matter how handy it may appear in other environments, you just don't need it. You don't need fork() in Python; therefore you don't need fancy debugging to work with fork(). If you think you need fork() you should either use subprocess, multiprocessing or C.
0
1
0
1
2011-09-01T09:39:00.000
5
-1
false
7,268,563
0
0
0
4
In perl debugger I can use DB::get_fork_TTY() to debug both parent and child process in different terminals. Is there anything similar in python debugger? Or, is there any good way to debug fork in python?
How to debug python scripts that fork
45,673,792
1
5
2,992
0
python,debugging,fork
The debugger in pyCharm does this nicely. It seems to use gdb with python support to accomplish that, however all the tutorials on how to do this with gdb by Hand which I've found so far didn't work for me. In pyCharm it just works.
0
1
0
1
2011-09-01T09:39:00.000
5
0.039979
false
7,268,563
0
0
0
4
In perl debugger I can use DB::get_fork_TTY() to debug both parent and child process in different terminals. Is there anything similar in python debugger? Or, is there any good way to debug fork in python?