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
List of IP addresses/hostnames from local network in Python
207,246
24
46
129,230
0
python,networking
If by "local" you mean on the same network segment, then you have to perform the following steps: Determine your own IP address Determine your own netmask Determine the network range Scan all the addresses (except the lowest, which is your network address and the highest, which is your broadcast address). Use your DNS...
0
1
1
0
2008-10-16T02:32:00.000
11
1.2
true
207,234
0
0
0
1
How can I get a list of the IP addresses or host names from a local network easily in Python? It would be best if it was multi-platform, but it needs to work on Mac OS X first, then others follow. Edit: By local I mean all active addresses within a local network, such as 192.168.xxx.xxx. So, if the IP address of my com...
Using os.execvp in Python
211,898
0
7
11,349
0
python,shell,exec
Make sure you aren't relying on shell expansion in your classpath. E.g. "~/my.jar" will get expanded by the shell in an os.system call, but not, I believe in an os.execvp call.
0
1
0
0
2008-10-17T03:04:00.000
2
0
false
210,978
0
0
1
1
I have a question about using os.execvp in Python. I have the following bit of code that's used to create a list of arguments: args = [ "java" , classpath , "-Djava.library.path=" + lib_path() , ea , "-Xmx1000m" , "-server" , "code_swarm" , params ] When I outpu...
How do you fix a Trac installation that begins giving errors relating to PYTHON_EGG_CACHE?
406,119
0
1
2,011
0
python,configuration,trac,python-egg-cache
I found that using the PythonOption directive in the site config did not work, but SetEnv did. The environment variable route will also work though.
0
1
0
1
2008-10-18T16:51:00.000
5
0
false
215,267
0
0
0
3
We've been using Trac for task/defect tracking and things were going well enough, but this morning it started serving up a 500 error. Looking in the Apache error_log, I get a stack trace that culminates in: PythonHandler trac.web.modpython_frontend: ExtractionError: Can't extract file(s) to egg cache The following ...
How do you fix a Trac installation that begins giving errors relating to PYTHON_EGG_CACHE?
219,233
0
1
2,011
0
python,configuration,trac,python-egg-cache
I had the same problem. In my case the directory wasn't there so I created and chown'ed it over to the apache user (apache on my centos 4.3 box). Then made sure it had read-write permissions on the directory. You could get by with giving rw rights to the directory if the group that owns the directory contains the ap...
0
1
0
1
2008-10-18T16:51:00.000
5
0
false
215,267
0
0
0
3
We've been using Trac for task/defect tracking and things were going well enough, but this morning it started serving up a 500 error. Looking in the Apache error_log, I get a stack trace that culminates in: PythonHandler trac.web.modpython_frontend: ExtractionError: Can't extract file(s) to egg cache The following ...
How do you fix a Trac installation that begins giving errors relating to PYTHON_EGG_CACHE?
215,401
1
1
2,011
0
python,configuration,trac,python-egg-cache
I have wrestled many a battle with PYTHON_EGG_CACHE and I never figured out the correct way of setting it - apache's envvars, httpd.conf (SetEnv and PythonOption), nothing worked. In the end I just unpacked all python eggs manually, there were only two or three anyway - problem gone. I never understood why on earth peo...
0
1
0
1
2008-10-18T16:51:00.000
5
0.039979
false
215,267
0
0
0
3
We've been using Trac for task/defect tracking and things were going well enough, but this morning it started serving up a 500 error. Looking in the Apache error_log, I get a stack trace that culminates in: PythonHandler trac.web.modpython_frontend: ExtractionError: Can't extract file(s) to egg cache The following ...
What's the difference between a parent and a reference property in Google App Engine?
216,187
15
10
1,067
1
python,api,google-app-engine
There are several differences: All entities with the same ancestor are in the same entity group. Transactions can only affect entities inside a single entity group. All writes to a single entity group are serialized, so throughput is limited. The parent entity is set on creation and is fixed. References can be changed...
0
1
0
0
2008-10-18T21:12:00.000
2
1.2
true
215,570
0
0
1
1
From what I understand, the parent attribute of a db.Model (typically defined/passed in the constructor call) allows you to define hierarchies in your data models. As a result, this increases the size of the entity group. However, it's not very clear to me why we would want to do that. Is this strictly for ACID complia...
Ensure a single instance of an application in Linux
220,536
0
33
22,567
0
python,linux,single-instance
If you create a lock file and put the pid in it, you can check your process id against it and tell if you crashed, no? I haven't done this personally, so take with appropriate amounts of salt. :p
0
1
0
0
2008-10-21T01:58:00.000
12
0
false
220,525
0
0
0
4
I'm working on a GUI application in WxPython, and I am not sure how I can ensure that only one copy of my application is running at any given time on the machine. Due to the nature of the application, running more than once doesn't make any sense, and will fail quickly. Under Win32, I can simply make a named mutex and ...
Ensure a single instance of an application in Linux
220,709
62
33
22,567
0
python,linux,single-instance
The Right Thing is advisory locking using flock(LOCK_EX); in Python, this is found in the fcntl module. Unlike pidfiles, these locks are always automatically released when your process dies for any reason, have no race conditions exist relating to file deletion (as the file doesn't need to be deleted to release the loc...
0
1
0
0
2008-10-21T01:58:00.000
12
1
false
220,525
0
0
0
4
I'm working on a GUI application in WxPython, and I am not sure how I can ensure that only one copy of my application is running at any given time on the machine. Due to the nature of the application, running more than once doesn't make any sense, and will fail quickly. Under Win32, I can simply make a named mutex and ...
Ensure a single instance of an application in Linux
220,541
0
33
22,567
0
python,linux,single-instance
By far the most common method is to drop a file into /var/run/ called [application].pid which contains only the PID of the running process, or parent process. As an alternative, you can create a named pipe in the same directory to be able to send messages to the active process, e.g. to open a new file.
0
1
0
0
2008-10-21T01:58:00.000
12
0
false
220,525
0
0
0
4
I'm working on a GUI application in WxPython, and I am not sure how I can ensure that only one copy of my application is running at any given time on the machine. Due to the nature of the application, running more than once doesn't make any sense, and will fail quickly. Under Win32, I can simply make a named mutex and ...
Ensure a single instance of an application in Linux
220,542
25
33
22,567
0
python,linux,single-instance
There are several common techniques including using semaphores. The one I see used most often is to create a "pid lock file" on startup that contains the pid of the running process. If the file already exists when the program starts up, open it up and grab the pid inside, check to see if a process with that pid is ru...
0
1
0
0
2008-10-21T01:58:00.000
12
1.2
true
220,525
0
0
0
4
I'm working on a GUI application in WxPython, and I am not sure how I can ensure that only one copy of my application is running at any given time on the machine. Due to the nature of the application, running more than once doesn't make any sense, and will fail quickly. Under Win32, I can simply make a named mutex and ...
Is it possible to set a timeout on a socket in Twisted?
24,895,751
0
9
7,051
0
python,networking,sockets,twisted
A better way to do this is with twisted.protocols.policies.TimeoutMixin. It's essentially doing a callLater but abstracted into a Mixin.
0
1
0
0
2008-10-21T12:56:00.000
4
0
false
221,745
0
0
0
1
I realize I'm probably just dumb and missing something big and important, but I can't figure out how to specify a timeout in twisted using reactor.listenUDP. My goal is to be able to specify a timeout, and after said amount of time, if DatagramProtocol.datagramReceived has not been executed, have it execute a callback ...
How do I get file creation and modification date/times?
367,166
-3
1,205
1,083,080
0
python,file
os.stat does include the creation time. There's just no definition of st_anything for the element of os.stat() that contains the time. So try this: os.stat('feedparser.py')[8] Compare that with your create date on the file in ls -lah They should be the same.
0
1
0
1
2008-10-25T21:54:00.000
12
-0.049958
false
237,079
0
0
0
2
What's the best cross-platform way to get file creation and modification dates/times, that works on both Linux and Windows?
How do I get file creation and modification date/times?
237,093
13
1,205
1,083,080
0
python,file
os.stat returns a named tuple with st_mtime and st_ctime attributes. The modification time is st_mtime on both platforms; unfortunately, on Windows, ctime means "creation time", whereas on POSIX it means "change time". I'm not aware of any way to get the creation time on POSIX platforms.
0
1
0
1
2008-10-25T21:54:00.000
12
1
false
237,079
0
0
0
2
What's the best cross-platform way to get file creation and modification dates/times, that works on both Linux and Windows?
How can I call a DLL from a scripting language?
239,098
4
9
3,922
0
python,perl,dll
For Python, you could compile an extension which links to the DLL, so that in Python you could just import it like a normal module. You could do this by hand, by using a library like Boost.Python, or by using a tool such as SWIG (which also supports Perl and other scripting languages) to generate a wrapper automaticall...
0
1
0
1
2008-10-27T03:42:00.000
5
0.158649
false
239,020
0
0
0
1
I have a third-party product, a terminal emulator, which provides a DLL that can be linked to a C program to basically automate the driving of this product (send keystrokes, detect what's on the screen and so forth). I want to drive it from a scripting language (I'm comfortable with Python and slightly less so with Per...
Possible to integrate Google AppEngine and Google Code for continuous integration?
241,672
1
18
2,320
0
python,svn,google-app-engine,continuous-integration,google-code
For those of us who are using Github, this feature from the GAE team would make us all seriously consider switching to Google Code...
0
1
0
0
2008-10-27T18:43:00.000
5
0.039979
false
241,007
0
0
1
2
Anyone have any thoughts on how/if it is possible to integrate Google Code commits to cause a Google AppEngine deployment of the most recent code? I have a simple Google AppEngine project's source hosted on Google Code and would love if everytime I committed to Subversion, that AppEngine would reflect the latest commit...
Possible to integrate Google AppEngine and Google Code for continuous integration?
241,126
1
18
2,320
0
python,svn,google-app-engine,continuous-integration,google-code
Very interesting, but not yet possible, AFAIK. I have been looking for that option in Google Code with no success. The only solution I can figure out is to install something in your machine that checks for changes in your SVN repository. I'll be happy to hear about other approaches.
0
1
0
0
2008-10-27T18:43:00.000
5
0.039979
false
241,007
0
0
1
2
Anyone have any thoughts on how/if it is possible to integrate Google Code commits to cause a Google AppEngine deployment of the most recent code? I have a simple Google AppEngine project's source hosted on Google Code and would love if everytime I committed to Subversion, that AppEngine would reflect the latest commit...
OpenGl with Python
242,063
1
15
18,416
0
python,opengl,fedora
What OpenGL library are you using? What windowing library? What version of Python? Most likely cause I can think of is that your windowing library (SDL or whatever you're using) isn't initializing OpenGL before you start calling into it.
1
1
0
0
2008-10-28T02:29:00.000
6
0.033321
false
242,059
0
0
0
5
I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a segmentation fault. I have no idea why this is. Just to avoid the "just use C" comments, here i...
OpenGl with Python
242,371
0
15
18,416
0
python,opengl,fedora
We have neither ideas about random segmentation faults. There is not enough information. What python libraries are you using for opengl? How do you use them? Can you show us your code? It's probably something trivial but my god -skill ends up to telling me just and only that. Raytracer in python? I'd prefer just doing ...
1
1
0
0
2008-10-28T02:29:00.000
6
0
false
242,059
0
0
0
5
I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a segmentation fault. I have no idea why this is. Just to avoid the "just use C" comments, here i...
OpenGl with Python
246,922
0
15
18,416
0
python,opengl,fedora
Perhaps you are calling an OpenGL function that requires an active OpenGL context, without having one? That shouldn't necessarily crash, but I guess it might. How to set up such a context depends on the platform, and it's been a while since I used GL from Python (and when I did, I also used GTK+ which complicates matte...
1
1
0
0
2008-10-28T02:29:00.000
6
0
false
242,059
0
0
0
5
I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a segmentation fault. I have no idea why this is. Just to avoid the "just use C" comments, here i...
OpenGl with Python
1,778,664
2
15
18,416
0
python,opengl,fedora
Well, I don't know if these are the libs the original poster are using but I saw identical issues in a pet project I'm working on (Graphics Engine using C++ and Python) using PyOpenGL. PyOpenGL didn't correctly pick up the rendering context if it was created after the python script had been loaded (I was loading the sc...
1
1
0
0
2008-10-28T02:29:00.000
6
0.066568
false
242,059
0
0
0
5
I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a segmentation fault. I have no idea why this is. Just to avoid the "just use C" comments, here i...
OpenGl with Python
2,284,461
0
15
18,416
0
python,opengl,fedora
Scripts never cause segmentation faults. But first see if your kernel and kmod video driver working property ... Extension modules can cause "segmentation fault".
1
1
0
0
2008-10-28T02:29:00.000
6
0
false
242,059
0
0
0
5
I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a segmentation fault. I have no idea why this is. Just to avoid the "just use C" comments, here i...
Is there something between a normal user account and root?
248,874
0
3
1,208
0
python,linux,root
I'm not familiar enough with Python to tell you what the necessary commands would be in that language, but you should be able to accomplish this by forking and using a pipe to communicate between the parent and child processes. Something along the lines of: Run the program as root via sudo or suid On startup, the pro...
0
1
0
0
2008-10-29T23:02:00.000
7
0
false
248,730
0
0
0
6
I'm developing an application that manages network interfaces on behalf of the user and it calls out to several external programs (such as ifconfig) that requires root to make changes. (Specifically, changing the IP address of a local interface, etc.) During development, I have been running the IDE as root (ugh) and th...
Is there something between a normal user account and root?
248,759
3
3
1,208
0
python,linux,root
What you want is a "Group" You create a group, specify that the account wanting to do the action belongs to the group, then you specify that the resource you want access to is a member of that group. Sometimes group management can be kind of irritating, but it should allow you to do anything you want, and it's the user...
0
1
0
0
2008-10-29T23:02:00.000
7
0.085505
false
248,730
0
0
0
6
I'm developing an application that manages network interfaces on behalf of the user and it calls out to several external programs (such as ifconfig) that requires root to make changes. (Specifically, changing the IP address of a local interface, etc.) During development, I have been running the IDE as root (ugh) and th...
Is there something between a normal user account and root?
248,756
1
3
1,208
0
python,linux,root
You could create and distribute a selinux policy for your application. Selinux allows the kind of fine-grained access that you need. If you can't or won't use selinux, then the daemon is the way to go.
0
1
0
0
2008-10-29T23:02:00.000
7
0.028564
false
248,730
0
0
0
6
I'm developing an application that manages network interfaces on behalf of the user and it calls out to several external programs (such as ifconfig) that requires root to make changes. (Specifically, changing the IP address of a local interface, etc.) During development, I have been running the IDE as root (ugh) and th...
Is there something between a normal user account and root?
248,758
7
3
1,208
0
python,linux,root
Your idea about the daemon has much merit, despite the complexity it introduces. As long as the actions don't require some user interface interaction as root, a daemon allows you to control what operations are allowed and disallowed. However, you can use SUDO to create a controlled compromise between ROOT and normal us...
0
1
0
0
2008-10-29T23:02:00.000
7
1.2
true
248,730
0
0
0
6
I'm developing an application that manages network interfaces on behalf of the user and it calls out to several external programs (such as ifconfig) that requires root to make changes. (Specifically, changing the IP address of a local interface, etc.) During development, I have been running the IDE as root (ugh) and th...
Is there something between a normal user account and root?
248,882
1
3
1,208
0
python,linux,root
The traditional way would be to create and use a setuid helper to do whatever you need. Note that, however, properly writing a setuid helper is tricky (there are several attack vectors you have to protect against). The modern way would be to use a daemon (running as root, started on boot) which listens to requests from...
0
1
0
0
2008-10-29T23:02:00.000
7
0.028564
false
248,730
0
0
0
6
I'm developing an application that manages network interfaces on behalf of the user and it calls out to several external programs (such as ifconfig) that requires root to make changes. (Specifically, changing the IP address of a local interface, etc.) During development, I have been running the IDE as root (ugh) and th...
Is there something between a normal user account and root?
248,743
0
3
1,208
0
python,linux,root
There's no single user that is halfway between a "normal" user and root. You have root, and then you have users; users can have differing levels of capabilities. If you want something that's more powerful than a "normal" user but not as powerful as root, you just create a new user with the capabilities you want, but do...
0
1
0
0
2008-10-29T23:02:00.000
7
0
false
248,730
0
0
0
6
I'm developing an application that manages network interfaces on behalf of the user and it calls out to several external programs (such as ifconfig) that requires root to make changes. (Specifically, changing the IP address of a local interface, etc.) During development, I have been running the IDE as root (ugh) and th...
OS X: Determine Trash location for a given path
249,800
2
1
3,560
0
python,macos,filesystems
The File Manager API has a pair of functions called FSMoveObjectToTrashAsync and FSPathMoveObjectToTrashSync. Not sure if that is exposed to Python or not.
0
1
0
0
2008-10-30T10:50:00.000
6
0.066568
false
249,785
0
0
0
1
Simply moving the file to ~/.Trash/ will not work, as if the file os on an external drive, it will move the file to the main system drive.. Also, there are other conditions, like files on external drives get moved to /Volumes/.Trash/501/ (or whatever the current user's ID is) Given a file or folder path, what is the co...
How to override HTTP request verb in GAE
255,906
3
1
1,104
0
python,google-app-engine,rest,metaclass
Calling the handler from initialize isn't the right way anyway - if you do that, the webapp will then call the original handler as well. Instead, you have a couple of options: You can subclass webapp.WSGIApplication and override call to select the method based on _method when it exists. You can check for the existence...
0
1
0
0
2008-10-31T22:37:00.000
2
0.291313
false
255,157
0
0
1
2
In the context of a Google App Engine Webapp framework application: I want to changed the request verb of a request in the case a parameter _method is provided, for example if a POST request comes in with a parameter _method=PUT, I need to change the request to call the put method of the handler. This is to cope with t...
How to override HTTP request verb in GAE
257,094
2
1
1,104
0
python,google-app-engine,rest,metaclass
Thats Arachnid for your response. Pointing me to the source of the framework was really helpful. Last I looked the source wasn't there(there was only .pyc), maybe it changed with the new version of the SDK. For my situation I think overriding WSGIApplication would have been the right thing to do. However, I chose to us...
0
1
0
0
2008-10-31T22:37:00.000
2
0.197375
false
255,157
0
0
1
2
In the context of a Google App Engine Webapp framework application: I want to changed the request verb of a request in the case a parameter _method is provided, for example if a POST request comes in with a parameter _method=PUT, I need to change the request to call the put method of the handler. This is to cope with t...
Play audio with Python
22,689,253
-1
135
259,664
0
python,audio
If you're on OSX, you can use the "os" module or "subprocess" etc. to call the OSX "play" command. From the OSX shell, it looks like play "bah.wav" It starts to play in about a half-second on my machine.
0
1
0
1
2008-11-04T03:11:00.000
25
-0.008
false
260,738
0
0
0
1
How can I play audio (it would be like a 1 second sound) from a Python script? It would be best if it was platform independent, but firstly it needs to work on a Mac. I know I could just execute the afplay file.mp3 command from within Python, but is it possible to do it in raw Python? I would also be better if it didn'...
How can I ask for root password but perform the action at a later time?
263,859
4
7
552
0
python,linux,ubuntu
Instead of chmod u+sing the shutdown command, allowing passwordless sudo access to that command would be better.. As for allowing shutdown at the end of the script, I suppose you could run the entire script with sudo, then drop privileges to the initial user at the start of the script?
0
1
0
0
2008-11-04T22:47:00.000
3
0.26052
false
263,773
0
0
0
3
I have a python script that I would like to add a "Shutdown when done" feature to. I know I can use gksudo (when the user clicks on "shutdown when done") to ask the user for root privileges but how can I use those privileges at a later time (when the script is actually finished). I have thought about chmod u+s on the s...
How can I ask for root password but perform the action at a later time?
263,851
1
7
552
0
python,linux,ubuntu
Escalate priority, spawn (fork (2)) a separate process that will wait (2), and drop priority in the main process.
0
1
0
0
2008-11-04T22:47:00.000
3
0.066568
false
263,773
0
0
0
3
I have a python script that I would like to add a "Shutdown when done" feature to. I know I can use gksudo (when the user clicks on "shutdown when done") to ask the user for root privileges but how can I use those privileges at a later time (when the script is actually finished). I have thought about chmod u+s on the s...
How can I ask for root password but perform the action at a later time?
263,804
3
7
552
0
python,linux,ubuntu
gksudo should have a timeout, I believe it's from the time you last executed a gksudo command. So I think I'd just throw out a "gksudo echo meh" or something every minute. Should reset the timer and keep you active until you reboot.
0
1
0
0
2008-11-04T22:47:00.000
3
1.2
true
263,773
0
0
0
3
I have a python script that I would like to add a "Shutdown when done" feature to. I know I can use gksudo (when the user clicks on "shutdown when done") to ask the user for root privileges but how can I use those privileges at a later time (when the script is actually finished). I have thought about chmod u+s on the s...
Python distutils and replacing strings in code
268,348
-1
2
283
0
python
"I often find a need to put paths in my code" -- this isn't very Pythonic to begin with. Ideally, your code lives in some place like site-packages and that's the end of that. Often, we have an installed "application" that uses a fairly fixed set of directories for working files. In linux, we get this information from...
0
1
0
0
2008-11-06T08:50:00.000
5
-0.039979
false
267,977
1
0
0
2
I often find a need to put paths in my code in order to find data or in some cases tool-specific modules. I've so far always used autotools because of this--it's just so easy to call sed to replace a few strings at build time. However, I'd like to find a more Pythonic way of doing this, i.e. use distutils or some oth...
Python distutils and replacing strings in code
348,082
0
2
283
0
python
The OP here, I've not finally managed to log in using my OpenID. @S.Lott Point well taken, but for some Linux distros it seems to be standard to install application-specific data and application-specific modules in specific locations. I think that making these locations configurable at build/install time is a nice thi...
0
1
0
0
2008-11-06T08:50:00.000
5
0
false
267,977
1
0
0
2
I often find a need to put paths in my code in order to find data or in some cases tool-specific modules. I've so far always used autotools because of this--it's just so easy to call sed to replace a few strings at build time. However, I'd like to find a more Pythonic way of doing this, i.e. use distutils or some oth...
How do I find the location of Python module sources?
269,814
1
564
717,501
0
python,module
Not all python modules are written in python. Datetime happens to be one of them that is not, and (on linux) is datetime.so. You would have to download the source code to the python standard library to get at it.
0
1
0
0
2008-11-06T18:36:00.000
20
0.01
false
269,795
1
0
0
5
How do I learn where the source file for a given Python module is installed? Is the method different on Windows than on Linux? I'm trying to look for the source of the datetime module in particular, but I'm interested in a more general answer as well.
How do I find the location of Python module sources?
32,784,452
103
564
717,501
0
python,module
If you're using pip to install your modules, just pip show $module the location is returned.
0
1
0
0
2008-11-06T18:36:00.000
20
1
false
269,795
1
0
0
5
How do I learn where the source file for a given Python module is installed? Is the method different on Windows than on Linux? I'm trying to look for the source of the datetime module in particular, but I'm interested in a more general answer as well.
How do I find the location of Python module sources?
27,230,006
1
564
717,501
0
python,module
For those who prefer a GUI solution: if you're using a gui such as Spyder (part of the Anaconda installation) you can just right-click the module name (such as "csv" in "import csv") and select "go to definition" - this will open the file, but also on the top you can see the exact file location ("C:....csv.py")
0
1
0
0
2008-11-06T18:36:00.000
20
0.01
false
269,795
1
0
0
5
How do I learn where the source file for a given Python module is installed? Is the method different on Windows than on Linux? I'm trying to look for the source of the datetime module in particular, but I'm interested in a more general answer as well.
How do I find the location of Python module sources?
72,396,307
-1
564
717,501
0
python,module
as written above in python just use help(module) ie import fractions help(fractions) if your module, in the example fractions, is installed then it will tell you location and info about it, if its not installed it says module not available if its not available it doesn't come by default with python in which case yo...
0
1
0
0
2008-11-06T18:36:00.000
20
-0.01
false
269,795
1
0
0
5
How do I learn where the source file for a given Python module is installed? Is the method different on Windows than on Linux? I'm trying to look for the source of the datetime module in particular, but I'm interested in a more general answer as well.
How do I find the location of Python module sources?
61,095,592
5
564
717,501
0
python,module
Another way to check if you have multiple python versions installed, from the terminal. $ python3 -m pip show pyperclip Location: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- $ python -m pip show pyperclip Location: /Users/umeshvuyyuru/Library/Python/2.7/lib/python/site-packages
0
1
0
0
2008-11-06T18:36:00.000
20
0.049958
false
269,795
1
0
0
5
How do I learn where the source file for a given Python module is installed? Is the method different on Windows than on Linux? I'm trying to look for the source of the datetime module in particular, but I'm interested in a more general answer as well.
Interactive console using Pydev in Eclipse?
1,116,728
0
36
27,430
0
python,debugging,console,pydev,interactive
When I set a break point and hit F11 Eclipse launches the debugger and prompts to open the "Debug Perspective". You can then open the Window-->Show View --> Expressions which opens the expressions view, you can then right click in the Expressions view windows and choose "Add Watch Expression" to add any expression(suc...
0
1
0
0
2008-11-07T09:34:00.000
5
0
false
271,625
1
0
0
3
I'm debugging my Python code in Eclipse using the Pydev plugin. I'm able to open a Pydev console and it gives me two options: "Console for currently active editor" and "Python console". However none of them is useful to inspect current variable status after a breakpoint. For example, the code stopped at a breakpoint an...
Interactive console using Pydev in Eclipse?
31,548,800
0
36
27,430
0
python,debugging,console,pydev,interactive
On a small monitor, you may not realize that the debug interactive console is different from the regular interactive console: it has a second command prompt at the bottom where you type, not at the top like the normal console.
0
1
0
0
2008-11-07T09:34:00.000
5
0
false
271,625
1
0
0
3
I'm debugging my Python code in Eclipse using the Pydev plugin. I'm able to open a Pydev console and it gives me two options: "Console for currently active editor" and "Python console". However none of them is useful to inspect current variable status after a breakpoint. For example, the code stopped at a breakpoint an...
Interactive console using Pydev in Eclipse?
271,692
1
36
27,430
0
python,debugging,console,pydev,interactive
Double click on "action" or any other variable. ctrl+shift+D And if you're using watches, I cant imagine better interaction. You are able to see every change.
0
1
0
0
2008-11-07T09:34:00.000
5
0.039979
false
271,625
1
0
0
3
I'm debugging my Python code in Eclipse using the Pydev plugin. I'm able to open a Pydev console and it gives me two options: "Console for currently active editor" and "Python console". However none of them is useful to inspect current variable status after a breakpoint. For example, the code stopped at a breakpoint an...
Python memory debugging with GDB
273,204
0
4
4,500
0
python,linux,debugging,openssl
If you're using CDLL to wrap a C library in python, and this is 64-bit linux, there's a good chance that you're CDLL wrapper is misconfigured. CDLL defaults to int return types on all platforms (should be a long long on 64-bit systems) and just expects you to pass the right arguments in. You may need to verify the CD...
0
1
0
0
2008-11-07T18:13:00.000
4
0
false
273,043
1
0
0
1
We have a Linux application that makes use of OpenSSL's Python bindings and I suspect it is causing random crashes. Occasionally, we see it crash with the message: Python Fatal Error: GC Object already tracked which would appear to be either a programming error on the part of the library, or a symptom of memory corr...
Python: How do I generate a keypress?
279,627
0
1
2,607
0
python,keypress,popen
What platform is this on? You may have to actually feed events into the event loop, if it's running on Win32.
0
1
0
1
2008-11-10T22:41:00.000
3
0
false
279,434
0
0
0
2
I am opening a process (with os.popen() ) that, for some commands, detects certain keypresses (e.g. ESC - not the character, the key). Is there a way to send keypress events to the process?
Python: How do I generate a keypress?
279,460
0
1
2,607
0
python,keypress,popen
The obvious way would be to start the process in it's own shell. something like os.popen("sh command")
0
1
0
1
2008-11-10T22:41:00.000
3
0
false
279,434
0
0
0
2
I am opening a process (with os.popen() ) that, for some commands, detects certain keypresses (e.g. ESC - not the character, the key). Is there a way to send keypress events to the process?
How can I download python .egg files, when behind a firewall
282,939
1
1
1,615
0
python,windows,linux,cygwin,turbogears
Add python to the firewall exceptions list. Just make sure you don't run any questionable code made in python, of course.
0
1
0
0
2008-11-12T03:15:00.000
5
0.039979
false
282,907
1
0
0
2
I'm going to try out turbogears however I'm on windows vista. however due to firewall proxy problems, it seems i can't download .egg files which is required for setup turbogears to get installed in my windows environment. I do have a bootable, or I can make a bootable Linux USB, I can try cygwin but I am not sure where...
How can I download python .egg files, when behind a firewall
283,271
2
1
1,615
0
python,windows,linux,cygwin,turbogears
You could use the old firewall hack... try throwing "?file.jpg" or "#file.jpg" on the end (sans quotes). The firewall may see this as you're trying to download an image file which it'll allow, the responding server probably won't care that you've attached a query string, and (I think) python will just see an egg.
0
1
0
0
2008-11-12T03:15:00.000
5
0.07983
false
282,907
1
0
0
2
I'm going to try out turbogears however I'm on windows vista. however due to firewall proxy problems, it seems i can't download .egg files which is required for setup turbogears to get installed in my windows environment. I do have a bootable, or I can make a bootable Linux USB, I can try cygwin but I am not sure where...
Why would an "command not recognized" error occur only when a window is populated?
286,436
0
1
1,123
0
python,windows
The suggested answer seems to have fixed the problem. I also realized that I needed to use os.name to determine which OS is being used, then I can use the correct path format for loading the external Python file.
0
1
0
0
2008-11-12T09:38:00.000
2
0
false
283,431
0
0
0
1
My record sheet app has a menu option for creating a new, blank record sheet. When I open a sheet window, I can open new windows without a problem, using subprocess.Popen() to do it. However, under Windows (I haven't tested it on other OSes yet), if I open a new window then use the "open file" dialog to populate the fi...
Search directory in SVN for files with specific file extension and copy to another folder?
291,477
2
2
1,000
0
python,svn,file
I think it is easiest to check out (or, better, export) the source tree using the svn command line utility: you can use os.system to invoke it. There are also direct Python-to-svn API bindings, but I would advise against using them if you are new to Python. You can then traverse the checkout folder, e.g. using os.walk;...
0
1
0
1
2008-11-14T21:16:00.000
1
1.2
true
291,467
0
0
0
1
I would like my python script to search through a directory in SVN, locate the files ending with a particular extension (eg. *.exe), and copy these files to a directory that has been created in my C drive. How can I do this? I'm new to Python so a detailed response and/or point in the right direction would be very much...
How do I find userid by login (Python under *NIX)
294,535
5
12
4,216
0
python,linux,unix,process-management
Never directly scan /etc/passwd. For instance, on a Linux system I administer, the user accounts are not on /etc/passwd, but on a LDAP server. The correct way is to use getpwent/getgrent and related C functions (as in @TFKyle's answer), which will get the information on the correct way for each system (on Linux glibc, ...
0
1
0
1
2008-11-16T22:11:00.000
2
0.462117
false
294,470
0
0
0
1
I need to set my process to run under 'nobody', I've found os.setuid(), but how do I find uid if I have login? I've found out that uids are in /etc/passwd, but maybe there is a more pythonic way than scanning /etc/passwd. Anybody?
Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?
628,329
8
70
64,229
0
java,python,performance,protocol-buffers,thrift
I did test performance of PB with number of other data formats (xml, json, default object serialization, hessian, one proprietary one) and libraries (jaxb, fast infoset, hand-written) for data binding task (both reading and writing), but thrift's format(s) was not included. Performance for formats with multiple convert...
0
1
0
1
2008-11-17T19:48:00.000
8
1
false
296,650
0
0
0
3
We're looking into transport/protocol solutions and were about to do various performance tests, so I thought I'd check with the community if they've already done this: Has anyone done server performance tests for simple echo services as well as serialization/deserialization for various messages sizes comparing EJB3, Th...
Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?
297,193
5
70
64,229
0
java,python,performance,protocol-buffers,thrift
If the raw net performance is the target, then nothing beats IIOP (see RMI/IIOP). Smallest possible footprint -- only binary data, no markup at all. Serialization/deserialization is very fast too. Since it's IIOP (that is CORBA), almost all languages have bindings. But I presume the performance is not the only requirem...
0
1
0
1
2008-11-17T19:48:00.000
8
0.124353
false
296,650
0
0
0
3
We're looking into transport/protocol solutions and were about to do various performance tests, so I thought I'd check with the community if they've already done this: Has anyone done server performance tests for simple echo services as well as serialization/deserialization for various messages sizes comparing EJB3, Th...
Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?
296,677
4
70
64,229
0
java,python,performance,protocol-buffers,thrift
One of the things near the top of my "to-do" list for PBs is to port Google's internal Protocol Buffer performance benchmark - it's mostly a case of taking confidential message formats and turning them into entirely bland ones, and then doing the same for the data. When that's been done, I'd imagine you could build the...
0
1
0
1
2008-11-17T19:48:00.000
8
0.099668
false
296,650
0
0
0
3
We're looking into transport/protocol solutions and were about to do various performance tests, so I thought I'd check with the community if they've already done this: Has anyone done server performance tests for simple echo services as well as serialization/deserialization for various messages sizes comparing EJB3, Th...
python (jython) archiving library
298,027
1
1
256
0
java,python,jython,archive
You can use java.util.zip, when I was using Jython the built in zip library in python didn't work
0
1
0
0
2008-11-18T06:32:00.000
2
0.099668
false
298,004
1
0
1
1
Is there a neat archiving library that automatically handles archiving a folder or directories for you out there? I am using Jython, so Java libs are also open for use. -UPDATE- Also Im looking for timestamp archiving. ie archive-dir/2008/11/16/zipfilebypreference.zip then the next day call it again and it creates ano...
How can I get my python (version 2.5) script to run a jar file inside a folder instead of from command line?
299,262
1
5
8,648
0
python
In general: Use os.chdir to change the directory of the parent process, then os.system to run the jar file. If you need to keep Python's working directory stable, you need to chdir back to original working directory - you need to record that with os.getcwd(). On Unix: Create a child process with os.fork explicitly. In ...
0
1
0
1
2008-11-18T16:22:00.000
2
0.099668
false
299,249
0
0
0
1
I am familiar with using the os.system to run from the command line. However, I would like to be able to run a jar file from inside of a specific folder, eg. my 'test' folder. This is because my jar (located in my 'test' folder) requires a file inside of my 'test' folder. So, how would I write a function in my script t...
Global hotkey for Python application in Gnome
302,168
2
6
1,770
0
python,gnome
Check out the Deskbar source code - they do this; afaik, they call out a C library that interacts with X11 to do the job
0
1
0
0
2008-11-19T15:08:00.000
2
1.2
true
302,163
0
0
0
1
I would like to assign a global hotkey to my Python application, running in Gnome. How do I do that? All I can find are two year old posts saying, well, pretty much nothing :-)
How do I remove/delete a folder that is not empty?
55,308,643
1
1,021
854,907
0
python,file
For Windows, if directory is not empty, and you have read-only files or you get errors like Access is denied The process cannot access the file because it is being used by another process Try this, os.system('rmdir /S /Q "{}"'.format(directory)) It's equivalent for rm -rf in Linux/Mac.
0
1
0
0
2008-11-19T20:15:00.000
20
0.01
false
303,200
0
0
0
1
I am getting an 'access is denied' error when I attempt to delete a folder that is not empty. I used the following command in my attempt: os.remove("/folder_name"). What is the most effective way of removing/deleting a folder/directory that is not empty?
What do I use on linux to make a python program executable
48,661,346
4
105
222,482
0
python,linux,file-permissions
If one want to make executable hello.py first find the path where python is in your os with : which python it usually resides under "/usr/bin/python" folder. at the very first line of hello.py one should add : #!/usr/bin/python then through linux command chmod one should just make it executable like : chmod +x hello.p...
0
1
0
0
2008-11-20T10:27:00.000
8
0.099668
false
304,883
0
0
0
2
I just installed a linux system (Kubuntu) and was wondering if there is a program to make python programs executable for linux.
What do I use on linux to make a python program executable
56,267,080
1
105
222,482
0
python,linux,file-permissions
I do the following: put #! /usr/bin/env python3 at top of script chmod u+x file.py Change .py to .command in file name This essentially turns the file into a bash executable. When you double-click it, it should run. This works in Unix-based systems.
0
1
0
0
2008-11-20T10:27:00.000
8
0.024995
false
304,883
0
0
0
2
I just installed a linux system (Kubuntu) and was wondering if there is a program to make python programs executable for linux.
Appropriate location for my application's cache on Windows
305,679
0
3
955
0
python,windows
Does the app have any preferences, settings or options that the user can specify? If so, add an option where the user can specify the location of the data, with a default of the current Windows temp directory. There's always a chance they may not have enough space on the drive with the temp directory, and would need to...
0
1
0
0
2008-11-20T15:28:00.000
7
0
false
305,647
1
0
0
1
My application caches some data on disk. Because the cache may be large, it should not be stored on a network drive. It should persist between invocations of the application. I have a mechanism for the user to choose a location, but would like the default to be sensible and "the right thing" for the platform. What i...
How can I get a list of the running applications with GTK?
306,866
0
2
368
0
python,gtk,pygtk
The panel you are referring to is the GNOME panel. So this is a GNOME question, not a GTK question. There is not a well-defined concept of "multi-window application" in GNOME that I know of. The panel task list is probably build by querying the window manager for the list of windows and grouping the windows by their "c...
1
1
0
0
2008-11-20T19:02:00.000
2
0
false
306,456
0
0
0
2
How can I get a list of the running applications? I'm referring to the ones in the panel at the bottom of the screen.
How can I get a list of the running applications with GTK?
307,046
3
2
368
0
python,gtk,pygtk
I believe what you are looking for is libwnck
1
1
0
0
2008-11-20T19:02:00.000
2
1.2
true
306,456
0
0
0
2
How can I get a list of the running applications? I'm referring to the ones in the panel at the bottom of the screen.
Python - Setting / Getting Environment Variables and Addrs
310,299
4
1
10,481
0
python,linux,environment-variables
For accessing and setting environment variables, read up on the os.environ dictionary. You can also use os.putenv to set an environment variable.
0
1
0
0
2008-11-21T20:37:00.000
3
0.26052
false
310,118
1
0
0
2
I need to set an environment variable in Python and find the address in memory where it is located. Since it's on Linux, I don't mind about using libraries that only work consistently on Linux (if that's the only way). How would you do this? Edit: The scope of the problem is as follows: I'm trying to hack a program for...
Python - Setting / Getting Environment Variables and Addrs
310,717
0
1
10,481
0
python,linux,environment-variables
Pass the address itself in an environment variable, and just read it with os.getenv().
0
1
0
0
2008-11-21T20:37:00.000
3
0
false
310,118
1
0
0
2
I need to set an environment variable in Python and find the address in memory where it is located. Since it's on Linux, I don't mind about using libraries that only work consistently on Linux (if that's the only way). How would you do this? Edit: The scope of the problem is as follows: I'm trying to hack a program for...
Python as FastCGI under windows and apache
318,517
2
6
3,212
0
python,windows,apache,fastcgi
You might find it easier to ditch FastCGI altogether and just run a python webserver on a localhost port. Then just use mod_rewrite to map the apache urls to the internal webserver. (I started offering FastCGI at my hosting company and to my surprise, nearly everyone ditched it in favor of just running their own web se...
0
1
1
0
2008-11-23T20:39:00.000
3
0.132549
false
312,928
0
0
0
1
I need to run a simple request/response python module under an existing system with windows/apache/FastCGI. All the FastCGI wrappers for python I tried work for Linux only (they use socket.fromfd() and other such shticks). Is there a wrapper that runs under windows?
Running a function periodically in twisted protocol
315,855
3
24
8,021
0
python,tcp,twisted,protocols
I'd imagine the easiest way to do that is to manage a list of clients in the protocol with connectionMade and connectionLost in the client and then use a LoopingCall to ask each client to send data. That feels a little invasive, but I don't think you'd want to do it without the protocol having some control over the tra...
0
1
0
0
2008-11-24T22:21:00.000
2
0.291313
false
315,716
0
0
0
1
I am looking for a way to periodically send some data over all clients connected to a TCP port. I am looking at twisted python and I am aware of reactor.callLater. But how do I use it to send some data to all connected clients periodically ? The data sending logic is in Protocol class and it is instantiated by the reac...
Ghostscript PDF -> TIFF throws an untrappable exception, when consuming files with asian fonts
317,300
1
0
416
0
python,jython,tiff,ghostscript
It may be that you need to read stderr from the child process.
0
1
0
1
2008-11-25T06:41:00.000
1
0.197375
false
316,518
0
0
0
1
Ghostscript curls up and dies, throwing an exception to stdout which I cannot catch and log. I am pretty sure it gets sick when I give it asian fonts. Has anybody backed into this problem and solved it?
Ensuring subprocesses are dead on exiting Python program
320,251
3
77
78,382
0
python,subprocess,kill,zombie-process
poll( ) Check if child process has terminated. Returns returncode attribute.
0
1
0
0
2008-11-26T10:21:00.000
15
0.039979
false
320,232
1
0
0
1
Is there a way to ensure all created subprocess are dead at exit time of a Python program? By subprocess I mean those created with subprocess.Popen(). If not, should I iterate over all of the issuing kills and then kills -9? anything cleaner?
Scripting language choice for initial performance
328,062
3
10
8,004
0
python,ruby,perl,bash,scripting-language
If Low memory and low startup time are truly important you might want to consider doing the work to keep the C code cross platform, however I have found this is rarely necessary. Personally I would use Ruby or Python for this type of job, they both make it very easy to make clear understandable code that others can mai...
0
1
0
1
2008-11-29T21:34:00.000
13
0.046121
false
328,041
0
0
0
9
I have a small lightweight application that is used as part of a larger solution. Currently it is written in C but I am looking to rewrite it using a cross-platform scripting language. The solution needs to run on Windows, Linux, Solaris, AIX and HP-UX. The existing C application works fine but I want to have a single ...
Scripting language choice for initial performance
328,075
0
10
8,004
0
python,ruby,perl,bash,scripting-language
I agree with others in that you should probably try to make this a more portable C app instead of porting it over to something else since any scripting language is going to introduce significant overhead from a startup perspective, have a much larger memory footprint, and will probably be much slower. In my experience,...
0
1
0
1
2008-11-29T21:34:00.000
13
0
false
328,041
0
0
0
9
I have a small lightweight application that is used as part of a larger solution. Currently it is written in C but I am looking to rewrite it using a cross-platform scripting language. The solution needs to run on Windows, Linux, Solaris, AIX and HP-UX. The existing C application works fine but I want to have a single ...
Scripting language choice for initial performance
328,054
5
10
8,004
0
python,ruby,perl,bash,scripting-language
When written properly, C should be platform independant and would only need a recompile for those different platforms. You might have to jump through some #ifdef hoops for the headers (not all systems use the same headers), but most normal (non-win32 API) calls are very portable. For web access (which I presume you nee...
0
1
0
1
2008-11-29T21:34:00.000
13
0.076772
false
328,041
0
0
0
9
I have a small lightweight application that is used as part of a larger solution. Currently it is written in C but I am looking to rewrite it using a cross-platform scripting language. The solution needs to run on Windows, Linux, Solaris, AIX and HP-UX. The existing C application works fine but I want to have a single ...
Scripting language choice for initial performance
328,120
4
10
8,004
0
python,ruby,perl,bash,scripting-language
I concur with Lua: it is super-portable, it has XML libraries, either native or by binding C libraries like Expat, it has a good socket library (LuaSocket) plus, for complex stuff, some cURL bindings, and is well known for being very lightweight (often embedded in low memory devices), very fast (one of the fastest scri...
0
1
0
1
2008-11-29T21:34:00.000
13
0.061461
false
328,041
0
0
0
9
I have a small lightweight application that is used as part of a larger solution. Currently it is written in C but I am looking to rewrite it using a cross-platform scripting language. The solution needs to run on Windows, Linux, Solaris, AIX and HP-UX. The existing C application works fine but I want to have a single ...
Scripting language choice for initial performance
328,065
9
10
8,004
0
python,ruby,perl,bash,scripting-language
Because of your requirement for fast startup time and a calling frequency greater than 1Hz I'd recommend either staying with C and figuring out how to make it portable (not always as easy as a few ifdefs) or exploring the possibility of turning it into a service daemon that is always running. Of course this depends on ...
0
1
0
1
2008-11-29T21:34:00.000
13
1.2
true
328,041
0
0
0
9
I have a small lightweight application that is used as part of a larger solution. Currently it is written in C but I am looking to rewrite it using a cross-platform scripting language. The solution needs to run on Windows, Linux, Solaris, AIX and HP-UX. The existing C application works fine but I want to have a single ...
Scripting language choice for initial performance
328,045
23
10
8,004
0
python,ruby,perl,bash,scripting-language
Lua is a scripting language that meets your criteria. It's certainly the fastest and lowest memory scripting language available.
0
1
0
1
2008-11-29T21:34:00.000
13
1
false
328,041
0
0
0
9
I have a small lightweight application that is used as part of a larger solution. Currently it is written in C but I am looking to rewrite it using a cross-platform scripting language. The solution needs to run on Windows, Linux, Solaris, AIX and HP-UX. The existing C application works fine but I want to have a single ...
Scripting language choice for initial performance
328,519
0
10
8,004
0
python,ruby,perl,bash,scripting-language
Port your app to Ruby. If your app is too slow, profile it and rewrite the those parts in C.
0
1
0
1
2008-11-29T21:34:00.000
13
0
false
328,041
0
0
0
9
I have a small lightweight application that is used as part of a larger solution. Currently it is written in C but I am looking to rewrite it using a cross-platform scripting language. The solution needs to run on Windows, Linux, Solaris, AIX and HP-UX. The existing C application works fine but I want to have a single ...
Scripting language choice for initial performance
328,129
6
10
8,004
0
python,ruby,perl,bash,scripting-language
"called anywhere from every minute to many times per second. As a consequence, keeping it's memory and startup time low are important." This doesn't sound like a script to me at all. This sounds like a server handling requests that arrive from every minute to several times a second. If it's a server, handling requests,...
0
1
0
1
2008-11-29T21:34:00.000
13
1
false
328,041
0
0
0
9
I have a small lightweight application that is used as part of a larger solution. Currently it is written in C but I am looking to rewrite it using a cross-platform scripting language. The solution needs to run on Windows, Linux, Solaris, AIX and HP-UX. The existing C application works fine but I want to have a single ...
Scripting language choice for initial performance
328,132
0
10
8,004
0
python,ruby,perl,bash,scripting-language
Can you instead have it be a long-running process and answer http or rpc requests? This would satisfy the latency requirements in almost any scenario, but I don't know if that would break your memory footprint constraints.
0
1
0
1
2008-11-29T21:34:00.000
13
0
false
328,041
0
0
0
9
I have a small lightweight application that is used as part of a larger solution. Currently it is written in C but I am looking to rewrite it using a cross-platform scripting language. The solution needs to run on Windows, Linux, Solaris, AIX and HP-UX. The existing C application works fine but I want to have a single ...
How to pack python libs I'm using so I can distribute them with my app and have as few dependencies as possible
331,703
2
4
505
0
python,linux,deployment
But if you make a deb with the correct dependencies listed the installer will download them for the user. That's the best way, as it's non redundant. Maybe you could make a tar or zip with your deb and all the third-party deb's and an install script that just install all the debs in the correct order. This way, if the...
0
1
0
0
2008-12-01T16:40:00.000
4
0.099668
false
331,377
1
0
0
1
How to pack python libs I'm using so I can distribute them with my app and have as few dependencies as possible and also not to conflict with different lib/version that is already on my system. L.E.: Sorry i forgot to specify. I will be doing this on linux. And I'm not referring in making my app a installable file like...
Python subprocess.call() fails when using pythonw.exe
337,990
7
5
6,198
0
python,multithreading,subprocess
sys.stdin and sys.stdout handles are invalid because pythonw does not provide console support as it runs as a deamon, so default arguments of subprocess.call() are failing. Deamon programs close stdin/stdout/stderr purposedly and use logging instead, so that you have to manage this yourself: I would suggest to use subp...
0
1
0
0
2008-12-03T16:54:00.000
3
1.2
true
337,870
1
0
0
2
I have some Python code that works correctly when I use python.exe to run it, but fails if I use pythonw.exe. def runStuff(commandLine): outputFileName = 'somefile.txt' outputFile = open(outputFileName, "w") try: result = subprocess.call(commandLine, shell=True, stdout=outputFi...
Python subprocess.call() fails when using pythonw.exe
25,453,133
2
5
6,198
0
python,multithreading,subprocess
This is an old question, but the same problem happened with pyInstaller too. In the truth, this will happen with any framework that converts code in python for exe without console. In my tests, I observed that if I use the flag "console=True" into my spec file (pyInstaller) the error no longer occurs. . The solution w...
0
1
0
0
2008-12-03T16:54:00.000
3
0.132549
false
337,870
1
0
0
2
I have some Python code that works correctly when I use python.exe to run it, but fails if I use pythonw.exe. def runStuff(commandLine): outputFileName = 'somefile.txt' outputFile = open(outputFileName, "w") try: result = subprocess.call(commandLine, shell=True, stdout=outputFi...
How can I reboot a Windows XP64 Machine in a Python Script?
341,369
4
4
521
0
python,windows
found it win32api.InitiateSystemShutdown("localhost", "Maintenance Reboot", 60, 1, 1)
0
1
0
0
2008-12-04T16:06:00.000
2
1.2
true
341,138
1
0
0
1
How can I reboot a Windows XP64 Machine in a Python Script? This machine does not have the "shutdown" or "restart" executables available.
Can I install Python 3.x and 2.x on the same Windows computer?
341,231
1
176
244,252
0
python,windows,python-3.x,compatibility
I think there is an option to setup the windows file association for .py files in the installer. Uncheck it and you should be fine. If not, you can easily re-associate .py files with the previous version. The simplest way is to right click on a .py file, select "open with" / "choose program". On the dialog that appe...
0
1
0
0
2008-12-04T16:18:00.000
20
0.01
false
341,184
1
0
0
5
I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine? I want to play with Python 3 while still being able to run 2.x scripts on the same machine.
Can I install Python 3.x and 2.x on the same Windows computer?
341,444
0
176
244,252
0
python,windows,python-3.x,compatibility
I would assume so, I have Python 2.4, 2.5 and 2.6 installed side-by-side on the same computer.
0
1
0
0
2008-12-04T16:18:00.000
20
0
false
341,184
1
0
0
5
I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine? I want to play with Python 3 while still being able to run 2.x scripts on the same machine.
Can I install Python 3.x and 2.x on the same Windows computer?
453,580
1
176
244,252
0
python,windows,python-3.x,compatibility
You should make sure that the PATH environment variable doesn't contain both python.exe files ( add the one you're currently using to run scripts on a day to day basis ) , or do as Kniht suggested with the batch files . Aside from that , I don't see why not . P.S : I have 2.6 installed as my "primary" python and 3.0 as...
0
1
0
0
2008-12-04T16:18:00.000
20
0.01
false
341,184
1
0
0
5
I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine? I want to play with Python 3 while still being able to run 2.x scripts on the same machine.
Can I install Python 3.x and 2.x on the same Windows computer?
341,216
4
176
244,252
0
python,windows,python-3.x,compatibility
As far as I know Python runs off of the commandline using the PATH variable as opposed to a registry setting. So if you point to the correct version on your PATH you will use that. Remember to restart your command prompt to use the new PATH settings.
0
1
0
0
2008-12-04T16:18:00.000
20
0.039979
false
341,184
1
0
0
5
I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine? I want to play with Python 3 while still being able to run 2.x scripts on the same machine.
Can I install Python 3.x and 2.x on the same Windows computer?
42,079,860
0
176
244,252
0
python,windows,python-3.x,compatibility
I am just starting out with python now. I'm reading Zed Shaw's book "Learn Python the Hard Way" which requires python version 2.x but am also taking a class that requires python 3.x So here is what I did. Download python 2.7 run power shell (should already be installed on windows) run python IN POWERSHELL (if it does...
0
1
0
0
2008-12-04T16:18:00.000
20
0
false
341,184
1
0
0
5
I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine? I want to play with Python 3 while still being able to run 2.x scripts on the same machine.
Where do I go from here -- regarding programming?
347,065
7
3
775
0
php,asp.net,python,linux
You will only have a first language for a little while. Pick any direction that interests you, and follow it. There is no way around the introduction "Drink from the Firehose" experience. Keep early project simple, and tangible. Build useful things and the motivation will be there. Web / desktop / mobile / etc, its all...
0
1
0
0
2008-12-07T00:49:00.000
9
1.2
true
347,054
0
0
0
7
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Where do I go from here -- regarding programming?
347,353
0
3
775
0
php,asp.net,python,linux
I had the same issue for a little while myself. I was getting bored of just being in PHP and wanted to be able to do more. I ended up settling on C# since it not only fulfilled the 'necessary evil' argument, but allows me to do anything I want in the MS realm, and is the closest syntax wise to another language (Java). ...
0
1
0
0
2008-12-07T00:49:00.000
9
0
false
347,054
0
0
0
7
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Where do I go from here -- regarding programming?
347,348
0
3
775
0
php,asp.net,python,linux
Really all you need to do is make sure you take baby steps and are doing something you are enjoying. I started off programming in visual basic on a little game. Not the best language, but it was a good starting point for me at the time. My point is, you don't need to pick the best language/operating system/anything fro...
0
1
0
0
2008-12-07T00:49:00.000
9
0
false
347,054
0
0
0
7
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Where do I go from here -- regarding programming?
347,120
0
3
775
0
php,asp.net,python,linux
I find some of my junior colleagues (atleast the ones that are very passionate about CS) asking similar questions (sometimes I find myself asking this too, even though I am now 12+ yrs into the industry). One advice I give them (and to myself too), which helped me, is - Focus on the job that is already assigned to yo...
0
1
0
0
2008-12-07T00:49:00.000
9
0
false
347,054
0
0
0
7
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Where do I go from here -- regarding programming?
347,066
2
3
775
0
php,asp.net,python,linux
The reason I settled in on Web Development as my course to learning programming is because I actually have a task to implement rather then aimlessly reading reference books etc. This is exactly the course to follow. I think most of us get into programming the same way. Find a problem and work out its solution in wh...
0
1
0
0
2008-12-07T00:49:00.000
9
0.044415
false
347,054
0
0
0
7
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Where do I go from here -- regarding programming?
347,121
0
3
775
0
php,asp.net,python,linux
Thanks for the thoughtful responses That seemed to be another distraction from learning programming for me anyway. I spent more time chasing apparent fixes for upgraded packages and such. Mostly things that were already working and it just seemed to not make much sense to spend time recreating the wheel so to speak. Be...
0
1
0
0
2008-12-07T00:49:00.000
9
0
false
347,054
0
0
0
7
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Where do I go from here -- regarding programming?
347,076
0
3
775
0
php,asp.net,python,linux
Don't worry so much about the direction you're going, just make sure that: a) You are enjoying it, and are understanding what you are doing. You don't have to initially understand concepts like polymorphism for example, but you should be understanding the basics of what you are doing. Just can't wrap your mind around T...
0
1
0
0
2008-12-07T00:49:00.000
9
0
false
347,054
0
0
0
7
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Execute Commands Sequentially in Python?
359,737
30
25
51,127
0
python,windows,subprocess
To do that, you would have to: supply the shell=True argument in the subprocess.Popen call, and separate the commands with: ; if running under a *nix shell (bash, ash, sh, ksh, csh, tcsh, zsh etc) & if running under the cmd.exe of Windows
0
1
0
0
2008-12-11T13:30:00.000
5
1
false
359,347
0
0
0
1
I would like to execute multiple commands in a row: i.e. (just to illustrate my need): cmd (the shell) then cd dir and ls and read the result of the ls. Any idea with subprocess module? Update: cd dir and ls are just an example. I need to run complex commands (following a particular order, without any pipelining). In f...
Access CVS through Apache service using SSPI
361,235
0
0
820
0
python,apache,cvs,sspi
Usage of SSPI make me think you are using CVSNT, thus a Windows system; what is the user you are running Apache into? Default user for services is SYSTEM, which does not share the same registry as your current user.
0
1
0
0
2008-12-11T21:05:00.000
1
1.2
true
360,911
0
0
1
1
I'm running an Apache server (v2.2.10) with mod_python, Python 2.5 and Django. I have a small web app that will show the current projects we have in CVS and allow users to make a build of the different projects (the build checks out the project, and copies certain files over with the source stripped out). On the Djang...
Is there anyone who has managed to compile mod_wsgi for apache on Mac OS X Leopard?
392,945
2
4
953
0
python,django,apache
This doesn't directly answer your question, but have you thought about using something like MacPorts for this sort of thing? If you're compiling a lot of software like this, MacPorts can really make your life easier, since building software and dependencies is practically automatic.
0
1
0
0
2008-12-15T18:39:00.000
1
0.379949
false
369,305
0
0
1
1
I'm working on a Django project that requires debugging on a multithreaded server. I've found mod_wsgi 2.0+ to be the easiest to work with, because of easy workarounds for python module reloading. Problem is can't get it to compile on Leopard. Is there anyone who has managed to do it so far, either for the builtin Apac...
Prevent ftplib from Downloading a File in Progress?
375,650
0
4
1,585
0
python,ftp,ftplib
You can't know when the OS copy is done. It could slow down or wait. For absolute certainty, you really need two files. The massive file. And a tiny trigger file. They can mess with the massive file all they want. But when they touch the trigger file, you're downloading both. If you can't get a trigger, you have t...
0
1
0
1
2008-12-17T18:54:00.000
4
0
false
375,620
0
0
0
4
We have a ftp system setup to monitor/download from remote ftp servers that are not under our control. The script connects to the remote ftp, and grabs the file names of files on the server, we then check to see if its something that has already been downloaded. If it hasn't been downloaded then we download the file an...
Prevent ftplib from Downloading a File in Progress?
375,800
5
4
1,585
0
python,ftp,ftplib
“Damn the torpedoes! Full speed ahead!” Just download the file. If it is a large file then after the download completes wait as long as is reasonable for your scenario and continue the download from the point it stopped. Repeat until there is no more stuff to download.
0
1
0
1
2008-12-17T18:54:00.000
4
1.2
true
375,620
0
0
0
4
We have a ftp system setup to monitor/download from remote ftp servers that are not under our control. The script connects to the remote ftp, and grabs the file names of files on the server, we then check to see if its something that has already been downloaded. If it hasn't been downloaded then we download the file an...