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
APPDATA is not returned in Python executed via CGI
11,246,816
1
1
496
0
python,apache,cgi,nltk,appdata
%APPDATA% is a special variable that expands to the "Application Data" directory of the user who expands the variable (i.e., who runs a script). Apache is not running as you, so it has no business knowing about your APPDATA directory. You should either hard-code the relevant path into your script, or replace it with a...
0
1
0
0
2012-06-27T04:16:00.000
3
0.066568
false
11,219,319
0
0
1
1
I'm using Python with the NLTK toolkit in Apache via CGI. The toolkit need to know the APPDATA directory, but when executed in the server, the os.environ not lists theAPPDATA. When I execute a simple print os.envrion in console, APPDATA is present, but not when executed via CGI in the web server. What is going on? How ...
CentOS 5.8 dependencies on Python 2.4?
11,251,911
1
0
1,419
0
python,centos
If python2.7 is available on Yum, you should use that: the package management on large distros (redhat, ubuntu, debian, fedora ) takes care of maintaining parallel Python installs for you which won't conflict with each other. This option should keep your system "/usr/bin/python¬ file pointing to Python2.4 and give you...
0
1
0
1
2012-06-27T10:49:00.000
1
1.2
true
11,224,517
0
0
0
1
I have a CentOS 5.8 server and am planning to install a later version of python (presumably 2.7). I have heard a lot of mention that CentOS relies quite heavily on 2.4 for many admin features etc. I'm trying to determine exactly what these features are (and whether I would actually be using them) so that I can decide w...
Getting mount type information in python on OSX
11,228,033
2
1
813
0
python,macos,mount
Have a look at the diskutil(8) and hdiutil(1) tools.
0
1
0
0
2012-06-27T13:40:00.000
1
1.2
true
11,227,579
0
0
0
1
Is there a way in which I can get some information about the mounts I have in the folder /Volumes in OSX? I want to be able to tell the difference between disk images like dmgs and other types, like hard disks or network mounts. I tried parsing the output of mount -v and looking if read-only is in the line but I doubt ...
Where to store the configuration files of python applications on Windows
11,228,733
2
10
4,707
0
python,windows
On Linux, it is common to store the configuration file in the users home directory, for instance ~/.myprogramrc. On windows Vista and up, users have a home directory as well (/Users/username) and a would recommend storing your settings there in a subfolder (/Users/useranem/myprogram). Storing the settings in the applic...
0
1
0
0
2012-06-27T14:35:00.000
3
0.132549
false
11,228,645
1
0
0
1
I have a python program that must work on Windows and Linux. There are some configuration options I normally store in a file, in a subdirectory of the program's directory. For Windows, I converted it to exe and created an Installer for it. And now I have the problem of dealing with the config file. What is the best pla...
Removing python
11,239,806
1
0
289
0
python
Most of the code written in Ubuntu is written in Python. One should avoid removing system dependencies at any time. You can do sudo apt-get install python but rest of the programs are probably gone; even though you install them manually, you can experience random bugs, system failures. I think you should just re-instal...
0
1
0
0
2012-06-28T06:55:00.000
1
1.2
true
11,239,467
1
0
0
1
I removed python from my computer to be reinstalled. However after removing it, many services has gone from my Ubuntu 10.04. (e.g. mozilla, Ubuntu Software Center and many applications from System tab.) How can I get back all of them? Thanks a lot..
store openid user in cookie google appengine
11,249,560
1
0
191
0
python,google-app-engine,cookies,openid
users.get_current_user() is actually reading the cookies so you don't need to do anything more to optimize it (you can easily verify it by deleting your cookies and then refreshing the page). Unless you want to store more information and have access to them without accessing the datastore on every request.
0
1
0
0
2012-06-28T16:47:00.000
1
1.2
true
11,249,313
0
0
1
1
I am using OpenID as a login system for a google appengine website and I right now for every website I am just passing the user info to every page using user = users.get_current_user() Would using a cookie to do this be more efficient? (I know if would be easier that putting that in every single webpage) and is these ...
How to check if Google App Engine python27 runs thread safe mode or not?
11,259,344
1
0
268
0
python,multithreading,google-app-engine,python-2.7
You can't have "some thread safe and some not thread safe". That's impossible. If some code is not thread safe, then none of the code is thread safe. That's just how thread safety works.
0
1
0
0
2012-06-29T08:48:00.000
2
0.099668
false
11,258,710
1
0
0
1
Please help how it is possible to detect if python27 runtime is run in thread safe mode or not for code? For example to notify that module is not compatible or apply threading code if required. I want to port some code to python27 as thread safe and some as not thread safe but not understand how it works in Google App ...
long running CPU intensive python script sent to sleep by scheduler
11,259,189
2
1
376
0
python,ubuntu,sysadmin,nice
The scheduler will only put your process on hold if there is another process ready to run. If you have no other processes which hog up the CPU, your process will be running most of the time. The scheduler does not put your process to sleep just because it feels like it. My guess is that there is some reason your proces...
0
1
0
0
2012-06-29T09:13:00.000
1
1.2
true
11,259,076
0
0
0
1
I have written a data munging script that is very CPU intensive. It has been running for a few days now, but now (thanks to trace messages sent to the console), I can see that it is not working (actually, has not been working for the last 10 hours or so. When I run top, I notice that the process is either sleeping (S) ...
what is the best way to do bidirectional IPC between a long-running c process and python?
11,263,176
1
3
1,766
0
python,c,ipc,protocol-buffers,thrift
My default choice would be to use normal sockets communicating over localhost. Sockets are a well understood language and platform neutral API that tend to perform very well. They also the advantage of not tieing you to two processes on the same box which can be advantageous in many situations.
0
1
0
0
2012-06-29T13:48:00.000
2
0.099668
false
11,262,984
0
0
0
1
I have an existing C process that can take one text input and produce a single image file. This C process has a high setup/teardown cost due to it's interface with an external system. Once the setup/teardown has occured the actual production of image from text is almost instantaneous. My plan is to daemonize the C proc...
Escaping arbitrary blocks of code
11,270,699
3
2
161
0
python,python-3.x
There are a few different options here. First, start with jdi's suggestion of using multiprocessing. It may be that Windows process creation isn't actually expensive enough to break your use case. If it actually is a problem, what I'd personally do is use Virtual PC, or even User Mode Linux, to just run the same code i...
0
1
0
0
2012-06-29T23:07:00.000
2
0.291313
false
11,270,021
1
0
0
1
My script accepts arbitrary-length and -content strings of Python code, then runs them inside exec() statements. If the time to run the arbitrary code passes over some predetermined limit, then the exec() statement needs to exit and a boolean flag needs to be set to indicate that a premature exit has occurred. How can ...
use standard datastore index or build my own
11,270,908
0
0
82
1
python,google-app-engine,indexing,google-cloud-datastore
I'd suggest using pre-existing code and building around that in stead of re-inventing the wheel.
0
1
0
0
2012-06-30T00:18:00.000
2
0
false
11,270,434
0
0
1
1
I am running a webapp on google appengine with python and my app lets users post topics and respond to them and the website is basically a collection of these posts categorized onto different pages. Now I only have around 200 posts and 30 visitors a day right now but that is already taking up nearly 20% of my reads and...
How to configure a virtual environment that doesn't require sudo?
11,278,661
0
2
134
0
python,pip,easy-install
Make sure you use a recent version of virtualenv itself, the latest at the time of writing is 1.7.2. Old versions required the use of -E switch, to install into the virtual environment.
0
1
0
0
2012-06-30T13:05:00.000
3
0
false
11,274,297
1
0
0
1
In my Ubuntu 12.04 machine, the installation of pip requirements is asking me for sudo permission every time it attempts to install. How would I override this, as this is terrible for my working environment to install things globally instead of inside the venv? Note: I did not setup the venv using sudo.
Is it feasible to run multiple processeses on a Heroku dyno?
11,282,872
4
10
2,842
0
python,heroku,subprocess,worker
On the newer Cedar stack, there are no issues with spawning multiple processes. Each dyno is a virtual machine and has no particular limitations except in memory and CPU usage (about 512 MB of memory, I think, and 1 CPU core). Following the newer installation instructions for some stacks such as Python will result in...
0
1
0
0
2012-07-01T04:15:00.000
1
1.2
true
11,279,527
0
0
1
1
I am aware of the memory limitations of the Heroku platform, and I know that it is far more scalable to separate an app into web and worker dynos. However, I still would like to run asynchronous tasks alongside the web process for testing purposes. Dynos are costly and I would like to prototype on the free instance tha...
deploying a Python application from a PHP developer
11,287,479
1
1
230
0
python,deployment
Copy the directory containing the virtualenv. Exclude all virtualenv-generated files. On the destination machine, create a virtualenv over the directory. source bin/activate pip install -r requirements.txt The first step is simplified if you use version control; you simply clone (Mercurial or Git) or checkout (Subvers...
0
1
0
0
2012-07-02T03:23:00.000
1
0.197375
false
11,287,466
1
0
0
1
I'm a little confused on the deployment process for Python. Let's say you create a brand new project with virtualenv source bin/activate pip install a few libraries write a simple hello world app pip freeze the dependencies When I deploy this code into a machine, do I need first make sure the machine is sourced befor...
Installing lxml in virtualenv for windows
23,508,071
0
6
2,061
0
python,lxml,virtualenv,pip
Just wanted to add that emeraldo.cs's answer is correct, but you also have to copy the lxml related files that exist in the site-packages root. Once all the files are copied, pip will think it's installed.
0
1
0
0
2012-07-02T03:48:00.000
3
0
false
11,287,585
1
0
0
1
I've recently started using virtualenv, and would like to install lxml in this isolated environment. Normally I would use the windows binary installer, but I want to use lxml in this virtualenv (not globally). Pip install does not work for lxml, so I'm at a loss for what I can do. I've read that creating symlinks may w...
In Macvim with +python3 supported, which command should I use to execute the current file itself?
11,288,495
3
0
428
0
python,vim,macvim
For Python 3, just simply execute :!python3 % Furthermore, you might also want to map it to a hotkey in your settings, like what I did: noremap <D-r> <esc>:w<CR>:!python3 %<CR> So that you can just press Command+r to execute the current code with Python 3 anytime (it will be saved automatically.
0
1
0
0
2012-07-02T04:40:00.000
2
1.2
true
11,287,862
1
0
0
1
I just set up IDE env for Python 3. I was wondering how I can run the file being currently edited in vim. I remembered that the command was ":python %", but it did not work for Python 3. Thank you very much.
Why is the argument of os.umask() inverted? (umask 0o000 makes chmod 0o777)
11,294,312
12
12
5,228
0
python,unix,filesystems,chmod,umask
There is no real inconsistency, as the relation between umask and chmod can purely be written down with equations. Apparently, umask sets the opposite of chmod, it was created like this back in the old days. Example: 022 (the default usual umask) creates 755. It works like this: 7 - 0 = 7 becomes the first byte 7 - 2 ...
0
1
0
0
2012-07-02T12:52:00.000
1
1.2
true
11,294,077
0
0
0
1
In most places, permissions are defined as an octal number in the format of 0777. But UNIX's umask command (thus os.umask()) needs 0o000 to produce the permission bits of 0o777 and 0o022 equals to 0o755 in my understanding. I heard that UNIX's umask is inverted for some reason and I do not understand the reason behind ...
"python" only runs from command prompt as Admin
11,296,830
2
1
2,992
0
python,cmd
To append your path with python directory: path=%PATH$;c:\Python27 Run as normal user. You should also double check that c:\python27\python.exe actually exists.
0
1
0
0
2012-07-02T15:23:00.000
3
1.2
true
11,296,583
0
0
0
3
I'm on Windows 7 and if I type "python" in the command prompt as my regular user, I get the old, "'python' is not recognized as an internal or external command, operable program or batch file." but if I open the prompt as the administrator, python initiates like it should. The very first thing I did was edit the PATH ...
"python" only runs from command prompt as Admin
24,021,057
1
1
2,992
0
python,cmd
So, one of the things I noticed when I had that problem is that the USERNAME environment variable was only set to system which is the administrator environment variable. I simply looked up the username in the regular command prompt, using echo %USERNAME% and appended a semicolon and the username to the %USERNAME& envir...
0
1
0
0
2012-07-02T15:23:00.000
3
0.066568
false
11,296,583
0
0
0
3
I'm on Windows 7 and if I type "python" in the command prompt as my regular user, I get the old, "'python' is not recognized as an internal or external command, operable program or batch file." but if I open the prompt as the administrator, python initiates like it should. The very first thing I did was edit the PATH ...
"python" only runs from command prompt as Admin
37,835,125
0
1
2,992
0
python,cmd
I've experienced a similar issue in the past and found that also checking the order of the values in the environmental/system variables matters as well.
0
1
0
0
2012-07-02T15:23:00.000
3
0
false
11,296,583
0
0
0
3
I'm on Windows 7 and if I type "python" in the command prompt as my regular user, I get the old, "'python' is not recognized as an internal or external command, operable program or batch file." but if I open the prompt as the administrator, python initiates like it should. The very first thing I did was edit the PATH ...
Need to get IP address to add to GAE blacklist
11,304,280
1
0
283
0
python,google-app-engine,ip,blacklist,denial-of-service
You could see the IP on the Logs page in the admin panel. Click the 'plus' icon next to a log item in order to expand it and view request data.
0
1
0
0
2012-07-03T03:56:00.000
1
0.197375
false
11,304,235
0
0
1
1
I'm getting a lot of requests to my appengine app from a malicious user and I suspect it might be an attempt at a DOS attack. I need to add thier IP address to blacklists on GAE. However when I look at self.request.remote_addr all I get is my own IP address. How can I get the remote IP of the client that is actually...
Update App Engine Tasks?
11,308,295
1
2
294
0
python,google-app-engine,task-queue
With pull queues, you can use modify_task_lease to set the ETA relative to the current time (even if you do not currently have the task leased). You can't change the ETA of a pull queue task. Each task's name remains unavailable for seven days.
0
1
0
0
2012-07-03T04:53:00.000
2
0.099668
false
11,304,679
0
0
1
2
Is it possible to update an AppEngine task in the task queue? Specifically, changing the eta property of the task to make it run at a different time? In my scenario, each item in my datastore has an associated task attached to it. If the element is updated, the task needs to updated with a new eta. I currently set th...
Update App Engine Tasks?
11,313,223
1
2
294
0
python,google-app-engine,task-queue
So I resolved this in the following way: I created an entry in my Model for a task_name. When I create the element and add a new task, I allow app engine to generate an automated, unique name for the task then retrieve the name of that task and save it with the model. This allows me to have that reference to the task. ...
0
1
0
0
2012-07-03T04:53:00.000
2
1.2
true
11,304,679
0
0
1
2
Is it possible to update an AppEngine task in the task queue? Specifically, changing the eta property of the task to make it run at a different time? In my scenario, each item in my datastore has an associated task attached to it. If the element is updated, the task needs to updated with a new eta. I currently set th...
compiling+distributing Linux code on Windows
11,347,955
0
2
534
0
c++,python,windows,linux,porting
I think your choice here depends on your goals for compiling under Windows. Are you preparing to involve other developers that can choose their development platform? Do you want to use a different compiler for additional warnings generation? Are you looking to deploy the application on the windows platform? Asking thes...
1
1
0
0
2012-07-03T15:29:00.000
1
1.2
true
11,314,253
1
0
0
1
I have a larger code running in Linux, written in c++ (c++11) and python and using numerous libraries (VTK, boost, pyqt, OpenGL) and compiles to python extension modules (and plugins of those modules) and pure python modules (the main program is a python script). The code is cross-platform (with a few exceptions, like ...
Spawning a non-child process in python
11,316,397
4
2
1,204
0
python,process,subprocess,popen
Terminating the parent process does not terminate child processes in Unix-like operating systems, so you don't need to do anything special. Just start your subprocesses with subprocess.Popen and terminate the main process. The orphaned processes will automatically be adopted by init.
0
1
0
0
2012-07-03T17:47:00.000
1
0.664037
false
11,316,369
1
0
0
1
I need to create spawn off a process in python that allows the calling process to exit while the child is still running. What is an effective way to do this? Note: I'm running on a UNIX environment.
key/value store with good performance for multiple tenants
11,319,983
0
1
239
1
javascript,python,google-app-engine,nosql,multi-tenant
The overhead of making calls from appengine to these external machines is going to be worse than the performance you're seeing now (I would expect). why not just move everything to a non-appengine machine? I can't speak for couch, but mongo or redis are definitely capable of handling serious load as long as they are se...
0
1
0
0
2012-07-03T22:08:00.000
2
0
false
11,319,890
0
0
1
2
im running a multi tenant GAE app where each tenant could have from a few 1000 to 100k documents. at this moment im trying to make a MVC javascript client app (the admin part of my app with spine.js) and i need CRUD endpoints and the ability to get a big amount of serialized objects at once. for this specific job appen...
key/value store with good performance for multiple tenants
11,323,377
2
1
239
1
javascript,python,google-app-engine,nosql,multi-tenant
Why not use the much faster regular appengine datastore instead of blobstore? Simply store your documents in regular entities as Blob property. Just make sure the entity size doesn't exceed 1 MB in which case you have to split up your data into more then one entity. I run an application whith millions of large Blobs th...
0
1
0
0
2012-07-03T22:08:00.000
2
1.2
true
11,319,890
0
0
1
2
im running a multi tenant GAE app where each tenant could have from a few 1000 to 100k documents. at this moment im trying to make a MVC javascript client app (the admin part of my app with spine.js) and i need CRUD endpoints and the ability to get a big amount of serialized objects at once. for this specific job appen...
Does python have a tool similar to Java's JPS
11,333,155
1
2
1,045
0
python,process
No. Each Python script has its own independent interpreter, so there is no convenient way to list all Python processes.
0
1
0
0
2012-07-04T17:00:00.000
3
0.066568
false
11,333,061
1
0
1
2
Does Python have a tool to list python processes similar to Java's jps (http://docs.oracle.com/javase/6/docs/technotes/tools/share/jps.html)? Edit: Getting the pid's of python processes is relatively easy (ps -A | grep python). What I am really looking for is a way to query a currently-running python process and find o...
Does python have a tool similar to Java's JPS
12,424,762
1
2
1,045
0
python,process
The best way I've found to get the information I need is using ps -x, which gives the original command line arguments of all running processes.
0
1
0
0
2012-07-04T17:00:00.000
3
1.2
true
11,333,061
1
0
1
2
Does Python have a tool to list python processes similar to Java's jps (http://docs.oracle.com/javase/6/docs/technotes/tools/share/jps.html)? Edit: Getting the pid's of python processes is relatively easy (ps -A | grep python). What I am really looking for is a way to query a currently-running python process and find o...
Python/Django development, windows or linux?
11,339,389
1
19
25,407
0
python,windows,django,linux
I normally use OSX on my desktop, but I use Linux for Python because that's how it will get deployed. Specifically, I use Ubuntu Desktop in a virtual machine to develop Python applications and I use Ubuntu on the server to deploy them. This means that my understanding of library and module requirements/dependencies a...
0
1
0
0
2012-07-05T05:43:00.000
5
0.039979
false
11,338,382
0
0
1
2
I have been working on Python quite a lot recently and started reading the doc for Django, however I can't deny the fact that most of the video tutorials I find usually shows Linux as the chosen OS. I've ignored this mostly, but I started to come upon some problems with people using commands such as "touch" for which I...
Python/Django development, windows or linux?
11,338,865
27
19
25,407
0
python,windows,django,linux
I used Windows for quite some time for Django development, but finally figured out that Linux is simply the better way to go. Here are some reasons why: some Python packages can not be installed at all or correctly in Windows OR it will create a lot of hassle for you to do so if you need to deploy your Django app it m...
0
1
0
0
2012-07-05T05:43:00.000
5
1.2
true
11,338,382
0
0
1
2
I have been working on Python quite a lot recently and started reading the doc for Django, however I can't deny the fact that most of the video tutorials I find usually shows Linux as the chosen OS. I've ignored this mostly, but I started to come upon some problems with people using commands such as "touch" for which I...
Will it be practical to implement deb preinst, postint, etc. scripts in Python, not in sh
11,350,615
8
9
912
0
python,debian,packaging,deb
The only reason this isn't commonly done, afaik, is that it's not convention, and Python isn't usually more useful or straightforward than plain shell script for the sorts of things that maintainer scripts do. When it is more useful, you can often break out the Python-needing functionality into a separate Python script...
0
1
0
1
2012-07-05T15:28:00.000
1
1.2
true
11,347,613
0
0
0
1
I'm interested in what pitfalls can be (except Python is not installed in target system) when using Python for deb package flow control scripts (preinst, postinst, etc.). Will it be practical to implement those scripts in Python, not in sh? As I understand it's at least possible.
Scraper Google App Engine for Steam
11,350,089
1
0
614
0
jquery,python,html,google-app-engine,steam-web-api
Since you have the steam id from the service you can then make another request to their steam community page via the id. From there you can use beautiful soup to return a dom to grab the required information for your project. Now onto your question. You can have all this happen within a request in a handler, if you a...
0
1
0
0
2012-07-05T17:46:00.000
2
0.099668
false
11,349,709
0
0
1
1
So basically, at the moment, we are trying to write a basic HTML 5 page that, when you press a button, returns whether the user, on Steam, is in-game, offline, or online. We have looked at the Steam API, and to find this information, it requires the person's 64 bit ID (steamID64) and we, on the website, are only given ...
What's the difference between timer and rbtimer in uWSGI?
11,353,126
11
5
826
0
python,timer,uwsgi
@timer uses kernel-level facilities, so they are limited in the maximum number of timers you can create. @rbtimer is completely userspace so you can create an unlimited number of timers at the cost of less precision
0
1
0
1
2012-07-05T19:06:00.000
1
1.2
true
11,350,907
0
0
1
1
I'm looking to add simple repeating tasks to my current application and I'm looking at the uwsgi signals api and there are two decorators @timer and @rbtimer. I've tried looking through the doc and even the python source at least but it appears it's probably more low level than that somewhere in the c implementation. I...
How do I make a Python script log out of the shell when it exits?
11,356,753
5
2
1,998
0
python,bash,shell
Set your python script as the login shell of the user(in /etc/passwd/). This way she will be automatically logged out after the script exits.
0
1
0
0
2012-07-06T06:04:00.000
4
0.244919
false
11,356,681
0
0
0
1
I'm writing a shell script in Python for bash. The script automatically runs when the user logs into the account, and I want it to log the user out when it exits. I tried using os.system('exit'), but it doesn't work. How would I achieve this?
What's the difference between /usr/lib/python and /usr/lib64/python?
11,370,887
4
10
10,916
0
python
The 64-bit version of the libraries? What version of Python are you running? If you are running the 32-bit version, then you probably won't need those files.
0
1
0
1
2012-07-06T23:24:00.000
2
1.2
true
11,370,877
1
0
0
1
I was using ubuntu. I found that many Python libraries installed went in both /usr/lib/python and /usr/lib64/python. When I print a module object, the module path showed that the module lived in /usr/lib/python. Why do we need the /usr/lib64/python directory then? What's the difference between these two directories? BT...
How to change the working directory for a shell script (newbie here)
11,387,734
1
0
2,233
0
python,linux,shell
The process that starts your python script (probably forkink) has a pwd (its working directory). The idea is to change the pwd of the process before to fork and execute python. You need to look over the manual of the process that executes the shell command, and see how to set the pwd.(in shell you use cd or pushd)
0
1
0
0
2012-07-09T00:00:00.000
3
0.066568
false
11,387,702
0
0
0
1
I have a python script that looks files up in a relative directory. For example: the python script is in /home/username/projectname/. I have a file that is being called within the python script that is in /home/username/projectname/subfolder. If I run the script from the shell as python scriptname.py it runs perfectly ...
Receive HTTP request in one Python process, reply from another
11,394,262
0
1
152
0
python,events,io,response,multiprocessing
You can't. Only one process can have access to one port at one time and you cannot respond directly without accessing the port. But you don't need that. What you need is proxy! You can add a thread to your app which will listen on a different port. Then you fire your image process and when that process finishes its wor...
0
1
0
0
2012-07-09T11:01:00.000
1
0
false
11,393,770
1
0
0
1
Can I "move" response object somehow from one process to another? The first process is a non-blocking server which does some other IO. It needs to be done in a non-blocking environment like Tornado or Twisted or something like this. Another process (actually, a pool of "worker" processes) is needed to process images wi...
Python startup script
11,404,208
7
11
28,023
0
python,startup
Python has a special script that is run on startup. On my platform it is located at /usr/lib/python2.5/site-packages/sitecustomize.py IIRC. So, you could either put init.py in that directory alongside a sitecustomize.py script that imports it, or just paste the content of init.py in the sitecustomize.py.
0
1
0
0
2012-07-09T22:32:00.000
2
1
false
11,404,165
1
0
0
1
I would like to execute a script work.py in Python, after executing some initialization script init.py. If I were looking for an interactive session, executing python -i init.py or setting PYTHONSTARTUP=/path/to/init.py would do the trick, but I am looking to execute another script. Since this is a generic case which o...
How do I install PyCrypto on Windows?
56,252,476
5
152
355,117
0
python,windows,python-2.7,pycrypto
If you are on Windows and struggling with installing Pycrypcto just use the: pip install pycryptodome. It works like a miracle and it will make your life much easier than trying to do a lot of configurations and tweaks.
0
1
0
0
2012-07-10T01:44:00.000
19
0.052583
false
11,405,549
1
0
0
4
I've read every other google source and SO thread, with nothing working. Python 2.7.3 32bit installed on Windows 7 64bit. Download, extracting, and then trying to install PyCrypto results in "Unable to find vcvarsall.bat". So I install MinGW and tack that on the install line as the compiler of choice. But then I get th...
How do I install PyCrypto on Windows?
45,761,612
3
152
355,117
0
python,windows,python-2.7,pycrypto
My answer might not be related to problem mention here, but I had same problem with Python 3.4 where Crypto.Cipher wasn't a valid import. So I tried installing PyCrypto and went into problems. After some research I found with 3.4 you should use pycryptodome. I install pycryptodome using pycharm and I was good. from Cry...
0
1
0
0
2012-07-10T01:44:00.000
19
0.031568
false
11,405,549
1
0
0
4
I've read every other google source and SO thread, with nothing working. Python 2.7.3 32bit installed on Windows 7 64bit. Download, extracting, and then trying to install PyCrypto results in "Unable to find vcvarsall.bat". So I install MinGW and tack that on the install line as the compiler of choice. But then I get th...
How do I install PyCrypto on Windows?
11,405,593
2
152
355,117
0
python,windows,python-2.7,pycrypto
This probably isn't the optimal solution but you might download and install the free Visual C++ Express package from MS. This will give you the C++ compiler you need to compile the PyCrypto code.
0
1
0
0
2012-07-10T01:44:00.000
19
0.02105
false
11,405,549
1
0
0
4
I've read every other google source and SO thread, with nothing working. Python 2.7.3 32bit installed on Windows 7 64bit. Download, extracting, and then trying to install PyCrypto results in "Unable to find vcvarsall.bat". So I install MinGW and tack that on the install line as the compiler of choice. But then I get th...
How do I install PyCrypto on Windows?
51,176,072
0
152
355,117
0
python,windows,python-2.7,pycrypto
I had Pycharm for python. Go to pycharm -> file -> setting -> project interpreter Click on + Search for "pycrypto" and install the package Note: If you don't have "Microsoft Visual C++ Compiler for Python 2.7" installed then it will prompt for installation, once installation finished try the above steps it should wor...
0
1
0
0
2012-07-10T01:44:00.000
19
0
false
11,405,549
1
0
0
4
I've read every other google source and SO thread, with nothing working. Python 2.7.3 32bit installed on Windows 7 64bit. Download, extracting, and then trying to install PyCrypto results in "Unable to find vcvarsall.bat". So I install MinGW and tack that on the install line as the compiler of choice. But then I get th...
Quick way to know if a file is open on Linux?
11,411,496
0
2
1,556
0
python,linux
You can check the modification time of the file and see if it has not been modified for a period of time. Since a file can be opened in update mode and be modified any time, you cannot be 100% sure that it will never be modified.
0
1
0
0
2012-07-10T10:31:00.000
11
0
false
11,411,428
0
0
0
5
Is there a quick way (i.e. that minimizes time-to-answer) to find out if a file is open on Linux? Let's say I have a process that writes a ton a files in a directory and another process which reads those files once they are finished writing, can the latter process know if a file is still being written to by the form...
Quick way to know if a file is open on Linux?
11,411,514
1
2
1,556
0
python,linux
If you can change the 'first' process logic, the easy solution would be to write data to a temp file and rename the file once all the data is written.
0
1
0
0
2012-07-10T10:31:00.000
11
0.01818
false
11,411,428
0
0
0
5
Is there a quick way (i.e. that minimizes time-to-answer) to find out if a file is open on Linux? Let's say I have a process that writes a ton a files in a directory and another process which reads those files once they are finished writing, can the latter process know if a file is still being written to by the form...
Quick way to know if a file is open on Linux?
11,411,550
2
2
1,556
0
python,linux
lsof | grep filename immediately comes to mind.
0
1
0
0
2012-07-10T10:31:00.000
11
0.036348
false
11,411,428
0
0
0
5
Is there a quick way (i.e. that minimizes time-to-answer) to find out if a file is open on Linux? Let's say I have a process that writes a ton a files in a directory and another process which reads those files once they are finished writing, can the latter process know if a file is still being written to by the form...
Quick way to know if a file is open on Linux?
11,411,884
0
2
1,556
0
python,linux
You can use fcntl module, afaik, it's has fcntl function that identical to C function, so something like fcntl(fd, F_GETFL) could be useful, but I'm not sure. Can you check is target file is blocked for writing by opening it in write mode?
0
1
0
0
2012-07-10T10:31:00.000
11
0
false
11,411,428
0
0
0
5
Is there a quick way (i.e. that minimizes time-to-answer) to find out if a file is open on Linux? Let's say I have a process that writes a ton a files in a directory and another process which reads those files once they are finished writing, can the latter process know if a file is still being written to by the form...
Quick way to know if a file is open on Linux?
11,411,493
10
2
1,556
0
python,linux
You can of course use INOTIFY feature of Linux, but it is safer to avoid the situation: let the writing process create the files (say data.tmp) which the reading process will definitely ignore. When the writer finishes, it should just rename the file for the reader (into say .dat). The rename operation guarantees that ...
0
1
0
0
2012-07-10T10:31:00.000
11
1.2
true
11,411,428
0
0
0
5
Is there a quick way (i.e. that minimizes time-to-answer) to find out if a file is open on Linux? Let's say I have a process that writes a ton a files in a directory and another process which reads those files once they are finished writing, can the latter process know if a file is still being written to by the form...
Cross-compiling in Python in Windows TO Linux/OSX
11,437,392
2
3
2,026
0
python,windows,python-2.7,cross-compiling
Get Virtualbox, install Ubuntu in it, and build it "natively" in for Linux. These things work really well, and cross compilation is just asking for trouble. You're going to eventually need Linux to answer the support questions you'll get from these customers anyway! :(
0
1
0
0
2012-07-11T16:35:00.000
2
0.197375
false
11,437,271
1
0
0
1
I have a program I've written in Python 2.7 on Windows, and I've been using py2exe with total success to make it into an exe (and associated files). However, a reasonable number of people who I want to use it are on Linux/OSX, and while some have been able to make the Windows version work with Wine, others have not bee...
Geany unable to execute Python
45,036,410
0
6
15,525
0
python,windows-7,geany
I faced this issue. Added python to PATH, working fine on cmd. But Geany wasn't able to execute. Turns out, while saving the file, I had not entered .py as extension. Once I did it, worked fine.
0
1
0
0
2012-07-11T19:01:00.000
4
0
false
11,439,607
1
0
0
2
I'm not a great coder, in fact I'm just trying to learn, but I can't get Geany to regonise Python in my system (Windows 7) when I try to execute the program. When I click Execute, it opens a command prompt saying: 'python' is not recognized as an internal or external command, operable program or batch file How can I ...
Geany unable to execute Python
13,714,776
2
6
15,525
0
python,windows-7,geany
I had the same problem and found that setting the path as described in the other prior posts was necessary but not sufficient. In my case, I had saved my script to the "geany" directory. It turns out that there was a permissions problem with the geany editor trying to create a temporary file in the geany folder. As ...
0
1
0
0
2012-07-11T19:01:00.000
4
0.099668
false
11,439,607
1
0
0
2
I'm not a great coder, in fact I'm just trying to learn, but I can't get Geany to regonise Python in my system (Windows 7) when I try to execute the program. When I click Execute, it opens a command prompt saying: 'python' is not recognized as an internal or external command, operable program or batch file How can I ...
How I can make apt-get install to my virtualenv?
53,515,591
3
30
30,665
0
python,virtualenv,apt-get
An alternative solution is to install globally, then followed by allowing the virtualenv to be able to see it. As an example, let's say we want to install matplotlib for Python 3: sudo apt update # Update first sudo apt install python3-matplotlib # Install globally sudo pip3 install -U virtualenv # Install virtualen...
0
1
0
0
2012-07-11T21:11:00.000
5
0.119427
false
11,441,546
1
0
0
1
It it's possible, of course. For example - I can download python-dbus like this: $ sudo apt-get download python-dbus But what I should to do next, with this .deb package in my current virtualenv?
python handling subprocess
20,869,726
0
2
144
0
python,for-loop,subprocess
A common way to detect things that have stopped working is to have them emit a signal at roughly regular intervals and have another process monitor the signal. If the monitor sees that no signal has arrived after, say, twice the interval it can take action such as killing and restarting the process. This general idea ...
0
1
0
0
2012-07-11T23:18:00.000
2
0
false
11,442,944
0
0
0
2
I am running an os.system(cmd) in a for-loop. Since sometimes it hangs, I am trying to use process=subprocess.pOpen(cmd) in a for-loop. But I want to know the following: If I do sleep(60) and then check if the process is still running by using process.poll(), how do I differentiate between process actually running eve...
python handling subprocess
11,443,356
4
2
144
0
python,for-loop,subprocess
I don't know of any general way to tell whether a process is hung or working. If a process hangs due to a locking issue, then it might consume 0% CPU and you might be able to guess that it is hung and not working; but if it hangs with an infinite loop, the process might make the CPU 100% busy but not accomplish any us...
0
1
0
0
2012-07-11T23:18:00.000
2
1.2
true
11,442,944
0
0
0
2
I am running an os.system(cmd) in a for-loop. Since sometimes it hangs, I am trying to use process=subprocess.pOpen(cmd) in a for-loop. But I want to know the following: If I do sleep(60) and then check if the process is still running by using process.poll(), how do I differentiate between process actually running eve...
How can I get pyflakes to run on Windows?
16,672,834
6
4
5,388
0
python,windows,pyflakes
Maybe this question is a bit old, because running "pip install pyflakes" worked flawlessly on Windows to me...
0
1
0
0
2012-07-12T02:26:00.000
3
1
false
11,444,245
1
0
0
1
Having trouble getting pyflakes to run on windows. On Windows there is no apt install , so... what to do?
Google App Engine - Choosing the right direction
11,460,359
4
0
2,564
0
python,django,google-app-engine,webapp2
The short answer is you can probably go either way, there will be some pros/some cons, but I don't think either is pure win. Here's some pros for using Django-nonrel as a newb: The django docs are generally pretty good. So it helps you get up to speed on some best practices CSRF protection Form validation sessions au...
0
1
0
0
2012-07-12T19:13:00.000
3
0.26052
false
11,458,969
0
0
1
1
I started web development 2 weeks ago using GAE,WebApp2,Jinja2 and WTForms. I read though several articles , discussions , watched lessons about web development with gae (udacity) and started a small project. Now I am very inexperienced in web-development and I don't know which path i should choose. . . The last few da...
Google App Engine + Google Cloud Storage + Sqlite3 + Django/Python
11,498,320
0
1
2,078
1
python,django,sqlite,google-app-engine,google-cloud-storage
No. SQLite requires native code libraries that aren't available on App Engine.
0
1
0
0
2012-07-12T23:44:00.000
3
1.2
true
11,462,291
0
0
1
2
since it is not possible to access mysql remotely on GAE, without the google cloud sql, could I put a sqlite3 file on google cloud storage and access it through the GAE with django.db.backends.sqlite3? Thanks.
Google App Engine + Google Cloud Storage + Sqlite3 + Django/Python
11,463,047
0
1
2,078
1
python,django,sqlite,google-app-engine,google-cloud-storage
Google Cloud SQL is meant for this, why don't you want to use it? If you have every frontend instance load the DB file, you'll have a really hard time synchronizing them. It just doesn't make sense. Why would you want to do this?
0
1
0
0
2012-07-12T23:44:00.000
3
0
false
11,462,291
0
0
1
2
since it is not possible to access mysql remotely on GAE, without the google cloud sql, could I put a sqlite3 file on google cloud storage and access it through the GAE with django.db.backends.sqlite3? Thanks.
Set up Python on Windows to not type "python" in cmd
67,924,065
2
27
17,143
0
python,windows,path,cmd
I also had the same issue... I could fix it by re-associating *.py files with the python launcher. Right click on a *.py file and open its properties. Click on the Change button of the "Opens with..." section Select More apps -> Look for another app on this PC. Then browse to your windows folder (by default: "C:\Windo...
0
1
0
0
2012-07-13T14:47:00.000
4
0.099668
false
11,472,843
0
0
1
1
How do I have to configure so that I don't have to type python script.py but simply script.py in CMD on Windows? I added my python directory to %PATH% that contains python.exe but still scripts are not run correctly. I tried it with django-admin.py Running django-admin.py startproject mysite gives me Type 'django-admi...
Whats a good command-oriented commandline framework for Python 2 and 3?
11,484,057
5
2
530
0
python,command-line,python-3.x
The argparse module from Python's standard library also supports commands, and it works in both, Python 2.x and 3.x.
0
1
0
0
2012-07-14T13:10:00.000
4
1.2
true
11,484,029
0
0
0
1
I like the cmdln framework for writing programs that work like svn command argument but it only works in Python 2. What's a good Python 3 alternative?
python patch : how to apply
11,489,520
1
1
3,549
0
python,patch,ubuntu-12.04
Unless you are running a custom-compiled version of Python that you pulled from the cvs server (which I'm pretty sure you are not), the best thing to do is to wait until an official build is provided by the Ubuntu packagers. Also, since this bug was found on Apr 19, 2012 and hasn't been bundled into Python 2.7's tarbal...
0
1
0
0
2012-07-15T04:41:00.000
2
0.099668
false
11,489,481
1
0
0
2
I am using Ubuntu 12.04 LTS; python 2.7.3 is pre-installed. A bug in python 2.7 distribution has been fixed in their repository. changeset 76420:ab9d6c4907e7 2.7 How do I apply this patch on my PC ? Thanks, Vineet
python patch : how to apply
11,489,496
1
1
3,549
0
python,patch,ubuntu-12.04
You can use the mercurial equivalents of following comands: svn log svn diff patch The "hg" equivalents of the first two commands will identify all the files that have changed and the the changes in them. The last command will apply the patches. Use the man command to get detailed usage information on the commands.
0
1
0
0
2012-07-15T04:41:00.000
2
1.2
true
11,489,481
1
0
0
2
I am using Ubuntu 12.04 LTS; python 2.7.3 is pre-installed. A bug in python 2.7 distribution has been fixed in their repository. changeset 76420:ab9d6c4907e7 2.7 How do I apply this patch on my PC ? Thanks, Vineet
Packaging a Python app with PyPI + OS-level dependencies
11,508,441
3
6
220
0
python,packaging,pip,pypi
distribute is a fork of setuptools with better perhaps documentation. You basically have distutils (stdlib) and setuptools as your choices. Since distutils doesn't let you specify dependencies, only setuptools is left. You generally list all dependencies, and document the installation procedure clearly (including in th...
0
1
0
0
2012-07-16T16:01:00.000
1
1.2
true
11,508,093
1
0
0
1
I would like to package a Python scientific application for PyPI. My problem is that it relies on PyPI-level deps (e.g. numpy, scipy, etc.) as well as others which must be dealt at the OS-level: wxPython and Python-VTK (e.g. with apt-get on Ubuntu, homebrew on OSX, etc). I'd like to know what would be the ideal strateg...
Virtualenv Python 2.4
22,384,632
1
4
1,376
0
python,virtualenv
The support for python2.4 was dropped in virtualenv 1.8 therefore make sure you use virtualenv<=1.7.2.
0
1
0
0
2012-07-16T17:14:00.000
2
0.099668
false
11,509,228
1
0
0
1
When using virtualenv I find that the command: virtualenv -p python2.6 --no-site-packages ~/env/NEW_PROJECT works without any problems, however if I try to do virtualenv -p python2.4 --no-site-packages ~/env/NEW_PROJECT I receive the error "The executable python2.4 (from --python=python2.4) does not exist. Is there a...
How can I find out if someone is actively using a Linux computer in Python or Java?
11,511,519
0
2
1,087
0
java,python
I second the answer by @Eero Aaltonen -- you should run your stuff under nice. A Linux computer can run at 100% CPU busy, yet feel nice and fast for the user, if the extra tasks are all under nice; the scheduler will only run the nice tasks when the main user's tasks are idle. But if you want to figure out if the mach...
0
1
0
1
2012-07-16T18:10:00.000
5
0
false
11,510,032
0
0
0
2
I want to write a program that ssh's into remote boxes and runs jobs there if the remote computer is not actively being used. I'll be logging in as clusterJobRunner@remoteBox, and the other user will be logged in as someLocalUser@remoteBox. Is there a way to see if a remote user is actively using the box using either ...
How can I find out if someone is actively using a Linux computer in Python or Java?
11,510,091
1
2
1,087
0
java,python
In Java you can execute the users Linux command using Runtime.exec(), grab the standard output and get it into a parsable String. I don't think there are any OS-independent ways to do this.
0
1
0
1
2012-07-16T18:10:00.000
5
0.039979
false
11,510,032
0
0
0
2
I want to write a program that ssh's into remote boxes and runs jobs there if the remote computer is not actively being used. I'll be logging in as clusterJobRunner@remoteBox, and the other user will be logged in as someLocalUser@remoteBox. Is there a way to see if a remote user is actively using the box using either ...
Python os.getcwd() returns with tilde in the path. e.g. C:\MYFOLD~1\test
11,512,534
0
4
1,149
0
python,path,directory,tilde,getcwd
Try to use os.path.realpath, os.path.normpath.
0
1
0
0
2012-07-16T20:55:00.000
4
0
false
11,512,413
0
0
0
2
How can I get python to return the full pathname of C:\myfolderisafolder\test?
Python os.getcwd() returns with tilde in the path. e.g. C:\MYFOLD~1\test
11,523,138
0
4
1,149
0
python,path,directory,tilde,getcwd
You could just split the string with .split() at the tilde and then rejoin the full filepath with the .join() methods.
0
1
0
0
2012-07-16T20:55:00.000
4
0
false
11,512,413
0
0
0
2
How can I get python to return the full pathname of C:\myfolderisafolder\test?
Exposing commandline tools remotely to users
11,515,334
2
0
132
0
python,http,command-line,cgi
Are the teammates developers or comfortable with the command line? If so, I would propose SSH. Run SSHD on the box with the scripts. On Windows, this is easy with cygwin, otherwise it's there by default on Mac and Linux The client logs in (ssh user@host) and runs the script. Set up security with certificates and you wo...
0
1
0
1
2012-07-17T00:44:00.000
2
0.197375
false
11,514,608
0
0
0
1
We've got a number of perl and python scripts we want to expose to some of our teammates for casual usage; and we really don't want ot deal with getting them setup with git, perl, python, dependencies, etc. One idea we had was to write a descriptor for each script as to what arguments it needed; and then let a simple H...
Waiting for a program to finish its task
11,518,020
1
0
220
0
python,process,applescript
I realized GUI applescript was the answer in this scenario. With it I could tell the PROCESS to get every window, and that worked. However, I'm leaving this up because I'd like to know other ways. I'm sure this GUI workaround won't work for everything.
0
1
0
0
2012-07-17T07:21:00.000
2
0.099668
false
11,517,743
0
0
0
1
I'd like to know how to have a program wait for another program to finish a task. I'm not sure what I'd look for for that... Also, I'm using a mac. I'd like to use Python or perhaps even applescript (I could just osascript python if the solution if for applescript anyway) Basically this program "MPEGstreamclip" convert...
GoogleAppEngine error: rdbms_mysqldb.py:74
11,533,684
1
3
1,146
1
google-app-engine,python-2.7
it's been a while, but I believe I've previously fixed this by adding import rdbms to dev_appserver.py hmm.. or was that import MySQLdb? (more likely)
0
1
0
0
2012-07-17T10:25:00.000
3
0.066568
false
11,520,573
0
0
1
2
Trying to do HelloWorld on GoogleAppEngine, but getting the following error. C:\LearningGoogleAppEngine\HelloWorld>dev_appserver.py helloworld WARNING 2012-07-17 10:21:37,250 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded. Traceback (most recent call last): File "C:...
GoogleAppEngine error: rdbms_mysqldb.py:74
12,513,978
0
3
1,146
1
google-app-engine,python-2.7
just had the exact same error messages: I found that restarting Windows fixed everything and I did not have to deviate from the YAML or py file given on the google helloworld python tutorial.
0
1
0
0
2012-07-17T10:25:00.000
3
0
false
11,520,573
0
0
1
2
Trying to do HelloWorld on GoogleAppEngine, but getting the following error. C:\LearningGoogleAppEngine\HelloWorld>dev_appserver.py helloworld WARNING 2012-07-17 10:21:37,250 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded. Traceback (most recent call last): File "C:...
LINUX End of Line
11,520,748
1
0
409
0
python,linux,ascii,vi
The $ is displayed by vi (in certain modes). It is not in the file contents. You could use od -cx yourfile to check that.
0
1
0
1
2012-07-17T10:34:00.000
2
1.2
true
11,520,713
1
0
0
1
I am reading a ASCII file from LINUX(Debian) into Python CGI script where it is edited via a web page and then saved, If I use a graphical text editor the edited and un-edited file appear the same and are corectly formatted. Using vi the edited file contains ctrl M as the EOL marker and all lines rolled into one but ...
When does the App Engine scheduler use a new thread vs. a new instance?
11,857,757
0
60
2,794
0
python,google-app-engine
If I set threadsafe: true in my app.yaml file, what are the rules that govern when a new instance will be created to serve a request, versus when a new thread will be created on an existing instance? Like people are saying here, if a previous instance is already using 10 threads, a new instance with a new thread would...
0
1
0
0
2012-07-17T15:23:00.000
3
0
false
11,525,717
1
0
1
1
If I set threadsafe: true in my app.yaml file, what are the rules that govern when a new instance will be created to serve a request, versus when a new thread will be created on an existing instance? If I have an app which performs something computationally intensive on each request, does multi-threading buy me anythin...
How to set python environmental variables?
11,526,266
3
1
559
0
python,environment-variables
Err, the simple answer while trying to make this at least 30chars is - Yes. (It doesn't matter what it's set to, as long as it's set - although 1 would probably be reasonable). If you don't want to do it on a system level/user level basis, then you can always run python with the -B option.
0
1
0
0
2012-07-17T15:49:00.000
1
1.2
true
11,526,228
1
0
0
1
I would like to prevent python from automatically creating __pycache__ directories. From some searching, I have learned that I need to set the PYTHONDONTWRITEBYTECODE python environment variable. In a Windows environment, is this set the exact same way I would set any other system environmental variable (such as PATH)...
MacPort: global does not accept --set
11,604,656
2
0
62
0
python,macports
-set is still there. The issue you have that you are missing a couple of arguments to the command. It should be sudo port select --set python python27 The port command takes an action and the one here is select. port select --set then takes as first argument the group it is select for in this case python.
0
1
0
0
2012-07-17T16:39:00.000
1
1.2
true
11,527,032
0
0
0
1
I am trying to change my default python to python27, I executed sudo port --set python27 but ended up with following error on my Mac Lion 10.7 Error: global does not accept --set. I was trying to see if MacPorts have deprecated the --set command and has introduced a new command instead. But I was unable to find anythin...
How to upgrade virtualenv to use a new system python?
11,528,399
1
2
2,650
0
python,virtualenv
You could try pip install -U python from within the virtual environment, not sure what it would break. You could also change the symlinks that point to the old Python, but not sure what side effects that would have. I would recommend the safest path, that is to first pip freeze > installed.txt and then recreate your vi...
0
1
0
0
2012-07-17T18:07:00.000
3
0.066568
false
11,528,327
1
0
0
1
I had installed virtualenv on the system with python2.6. I upgraded the system python to 2.7, but the virtualenv still has affinity for python2.6. I tried easy_install --upgrade virtualenv, but that didn't change anything. Does anyone know how to update the system installed virtualenv to use the new python2.7 on the sy...
How to get Django to use an updated python on Mac OS X server?
11,531,064
1
0
251
0
django,python-2.7,osx-server
Install it against the updated Python.
0
1
0
0
2012-07-17T21:18:00.000
2
0.099668
false
11,531,025
0
0
1
1
I am using Django on my Mac OS X server. Things are fine, so far. I have been using python 2.6.1 and all works well. I upgraded Python to version 2.7.3. Invoking python in the terminal brings up version 2.7.3, as expected. Checking Django using the {% debug %) reveals that Django is still using the original python 2.6....
Eclpise and pyDev
11,579,758
0
0
86
0
python,eclipse,pydev
My guess is that the problem is that you're probably pointing to a shortcut and not the actual executable, so, can you check if you're really giving the executable (and not a shortcut) in the interpreter configuration process? If that's not the case, please post details you may have in your error log during that proces...
0
1
0
0
2012-07-18T09:12:00.000
2
0
false
11,537,981
1
0
0
1
Possible duplicate but i couldn't find one. I've downloaded python and am having trouble loading it into eclipse, has anyone got a fool proof ground up solution that is garaunteed to work. This is what i've tried, Window--preferences--new--specified(Python 32) and C:\ directory file to python.exe but it keeps spitting...
Python path setting error with manage.py
11,550,187
1
1
1,723
0
python,django
Do not add #!/usr/bin/python . Use virtualenv and activate it before running python manage.py your_command . When you will be familiar with virtualenv try virtualenvwrapper.
0
1
0
0
2012-07-18T16:03:00.000
1
1.2
true
11,545,577
0
0
0
1
When I run ./manage.py, I get the following error, from: can't read /var/mail/os.path ./manage.py: line 4: import: command not found ./manage.py: line 7: syntax error near unexpected token `0,' ./manage.py: line 7: `sys.path.insert( 0, abspath( join( dirname( file ), 'external_apps' ) ) )' What is it!!! How can I resol...
Can I format the output of logger action of a content rule as CSV in Plone 4.1?
11,560,834
-1
1
85
0
python,plone
This can be achieved in two ways, these two methods are differentiated in Step 3: Step 1: Records are generally written in a line in zinstance.log. (There are some instances where it is written in multiple lines, so you need to handle exceptions). So here you can use readline function to read each record. Step 2: After...
0
1
0
0
2012-07-19T11:20:00.000
1
-0.197375
false
11,559,752
0
0
1
1
I created a content rule to run a logger action, when a new content is added viz a file. When I run the view of the zinstance.log file,on linux I see all the logs. I wish to send the output for each logger action separately to another log file, so that it contains log concerned to that rule only where ever applicable i...
Running python 3.2 programs from cygwin(windows 7 user)
11,573,304
0
1
319
0
python,python-3.x,cygwin
Ok.one solution i have found is that i can invoke cygwin through command window and then pass instructions using subprocess.However being able to run python 3.2 codes from cygwin would have been more preferable to me rather than the other way round!!
0
1
0
0
2012-07-19T13:18:00.000
3
0
false
11,561,744
1
0
0
1
I need to be able to run python 3.2 scripts from cygwin.However,the current setup of cygwin shows it isnt compatible with that.I searched on the internet and saw in some other forums that people have ben unable to do it.Anyone here has any idea how to do it?
site.addsitedir doesn't add egg to sys.path
11,576,705
2
0
3,434
0
python,pythonpath
If I set PYTHONPATH to contain that prefix's site-packages directory, the egg is added to sys.path and the module can be imported. Adding some directory to PYTHONPATH doesn't trigger processing of .pth-files in it. Therefore your zipped egg won't be in sys.path. You can import a module from the egg only if the egg it...
0
1
0
1
2012-07-19T14:11:00.000
1
1.2
true
11,562,721
1
0
0
1
I have a python module packaged by distutils into a zipped egg installed in a custom prefix. If I set PYTHONPATH to contain that prefix's site-packages directory, the egg is added to sys.path and the module can be imported. If I instead from within the script run site.addsitedir with the prefix's site-packages director...
Getting jobs from beanstalkd - timed out exception
11,570,528
4
0
1,433
0
python,timeout,jobs,beanstalkd,beanstalkc
Calling beanstalk.reserve(timeout=0) means to wait 0 seconds for a job to become available, so it'll time out immediately unless a job is already in the queue when it's called. If you want it never to time out, use timeout=None (or omit the timeout parameter, since None is the default).
0
1
0
1
2012-07-19T18:53:00.000
1
1.2
true
11,567,431
0
0
1
1
I am using Python 2.7, beanstalkd server with beanstalkc as the client library. It takes about 500 to 1500 ms to process each job, depending on the size of the job. I have a cron job that will keep adding jobs to the beanstalkd queue and a "worker" that will run in an infinite loop getting jobs and processing them. eg...
How to activate/deactivate a virtualenv from python code?
22,811,410
0
10
6,178
0
python,virtualenv
If you want to run a program outside of the virtualenv, just run your system python executable (e.g. /usr/bin/python) instead of the one in the virtualenv.
0
1
0
0
2012-07-20T05:13:00.000
4
0
false
11,573,261
1
0
0
3
For activation there is a script that activates a virtualenv from an already running python interpeter using execfile('C:/path/to/virtualev/Scripts/activate_this.py', dict(__file__='C:/path/to/virtualev/Scripts/activate_this.py')). However since I can still import packages that are not in the virtualenv from the curren...
How to activate/deactivate a virtualenv from python code?
11,573,607
-3
10
6,178
0
python,virtualenv
This souds like bad idea. You are trying to modify environment of your script within this script. Please explain why? Can't you do it hierarchical? Use one script to run different scripts in different virtualenvs.
0
1
0
0
2012-07-20T05:13:00.000
4
-0.148885
false
11,573,261
1
0
0
3
For activation there is a script that activates a virtualenv from an already running python interpeter using execfile('C:/path/to/virtualev/Scripts/activate_this.py', dict(__file__='C:/path/to/virtualev/Scripts/activate_this.py')). However since I can still import packages that are not in the virtualenv from the curren...
How to activate/deactivate a virtualenv from python code?
18,660,299
-4
10
6,178
0
python,virtualenv
at the command line, type the word 'deactivate'
0
1
0
0
2012-07-20T05:13:00.000
4
-1
false
11,573,261
1
0
0
3
For activation there is a script that activates a virtualenv from an already running python interpeter using execfile('C:/path/to/virtualev/Scripts/activate_this.py', dict(__file__='C:/path/to/virtualev/Scripts/activate_this.py')). However since I can still import packages that are not in the virtualenv from the curren...
Python prevent os.getcwd() to give lower case results on windows using MKS shell
12,109,258
0
1
402
0
python,mks
Before starting Python and using os.getcwd(), in your console you probably used "cd c:\your_path". It matters if this 'c' is lower or upper.
0
1
0
0
2012-07-20T12:44:00.000
2
0
false
11,579,652
0
0
0
1
On Windows if i use MKS toolkit shell, os.getcwd() function returns value in lower case. However on using windows cmd, it returned exact path. Is it possible in Python by any means for os.getcwd() to return the exact path (without converting to lower case on Windows)?
GAE - Online admin console
11,595,724
0
0
172
0
python,google-app-engine
You can use remote shell, that is on your app engine sdk. For example ~/bin/google_appengine/remote_api_shell.py -s your-app-identifier.appspot.com s~your-app-identifier When you are inside the shell, you will have the db module enabled. in order to use your models, you will have to import them.
0
1
0
0
2012-07-21T05:55:00.000
2
0
false
11,589,862
0
0
1
1
Is there some way I can run custom python code on my google appengine app online? Is there a python console somewhere that I can use? I've seen vague references here and there, but nothing concrete.
Python: Hide sub-process print out on the terminal and continue the script while sub is running
39,337,469
0
0
665
0
python,debian,subprocess,scapy
In the spot where you put the command airodump-ng replace that part with timeout 'X's airodump-ng mon'X'
0
1
0
0
2012-07-21T07:19:00.000
2
0
false
11,590,258
0
0
0
1
is there a way to use python2.6 with either subprocess.Popen() or os.system() to run two tasks? Example the script will run "airodump-ng" first then this process is sub and is hidden(meaning will not print out from terminal) after which continue run the rest of the script which contain "sniff" function of scapy. I been...
Writing a simple Mac App to start a python document
11,595,693
2
0
115
0
python,macos,terminal
Automator is great for this. Your one-line command, as an automator service, could be run from a keystroke. You can also make a terminal profile that runs the command when the profile is launched. You could also use applescript editor and make a (relatively simple) applescript that does the 'do script' command, to run ...
0
1
0
0
2012-07-21T09:41:00.000
1
0.379949
false
11,591,087
0
0
0
1
I am writing a Mac program in python that will run in terminal, and have a start.command file to start it up: #!/bin/bash cd "$(dirname "$0")" exec python "$(dirname "$0")/xavier_root/xavier_I-nil-nil.py" I was wondering though, if there would be a way to create a .app that would start up this program instead, so that ...
keyboard interrupt doesn't stop my interpreter
11,592,469
6
1
6,153
0
python,terminal,osx-lion,infinite-loop
CTRL + Z sends to background, CTRL + C is to kill. However I am talking Linux here and Mac might be something different.
0
1
0
0
2012-07-21T13:05:00.000
1
1.2
true
11,592,433
0
0
0
1
I am testing a Log-parser that does a infinite loop (on purpose) with a cool down of 3 seconds every recurrence. Eventually I will link all the data to a GUI front-end so I can call a stop to the loop when the user is ready with parsing. The (small) problem now is, when testing the output in the Terminal (in OSX) when ...
How to write tests for static routes defined in app.yaml?
11,600,406
1
1
120
0
python,unit-testing,google-app-engine
I have a post deploy script for the staging environment that just does curl on the urls to validate they are all there. If this script passes (among other things) I will deploy from staging to production.
0
1
0
1
2012-07-22T12:39:00.000
1
0.197375
false
11,600,374
0
0
1
1
I have quite a few static files used in my Google App Engine application (CSS, robots.txt, etc.) They are all defined in app.yaml. I want to have some automated tests that check whether those definitions in app.yaml are valid and my latest changes didn't brake anything. E.g. check that specific URLs return correct resp...
check to see if a directory is valid in Python
26,087,266
-1
3
4,550
0
python,windows,linux,directory
if you use os.path.join to create the directory string you will correctly writes the path depending on the environment you are in. then you can use os.path.isdir, as suggested above. to verify if the string points to an existing directory
0
1
0
0
2012-07-22T21:52:00.000
3
-0.066568
false
11,604,256
1
0
0
1
I have a program in python 2.7 that is writing certain files and directories base on user input. I need to make sure that the files and directories are valid for both linux and windows as the files will be exchanged through the two operating systems. The files will originally be created in linux and manual moved to w...
Running python script in Blender
12,752,197
0
40
87,536
0
python,blender
It is likely that drawcar.py is trying to perform pyOpenGL commands inside Blender, and that won't work without modification. I suspect you are getting some import errors too (if you look at the command console). Blender has it's own internal python wrapper for opengl called bgl, which does include a lot of the opengl...
0
1
0
0
2012-07-22T22:38:00.000
5
0
false
11,604,548
0
0
0
1
I installed Blender 2.6 and I'm trying to run a script called drawcar.py (Which uses PyOpenGL) I looked around the documentation for importing a script and could only access Blender's python console. How do I run drawcar.py from the Linux terminal with Blender?
ClientDC and WindowDC do not draw under Fedora 16 Gnome 3, only PaintDC
11,617,941
1
0
76
0
linux,wxpython,fedora,gnome-3,gdi
I think the recommended way to paint is with the newer wx.GCDC with a fallback to the wx.PaintDC. If you need advanced drawing, see FloatCanvas, cairo or the glcanvas.
1
1
0
0
2012-07-23T06:42:00.000
1
0.197375
false
11,607,571
0
0
0
1
I am writing an app which draws text and shapes in a ClientDC of a Frame. When I run the app under my Fedora 16(Gnome 3) nothing is drawn in the Frame, but if I run it under Windows all drawings display normally. I've tried using WindowDC to do the drawing on, but it is not different to ClientDC under Fedora. I can onl...
python or bash script that does something when there is no response(output)
11,611,070
0
0
124
0
python,bash
In a Bash-script, you could redirect the output to a file, and if the length of the file is zero then there was no output.
0
1
0
0
2012-07-23T10:45:00.000
3
0
false
11,611,002
0
0
0
1
There is an external program A. I want to write a script that does some action if the called external program A does not bring up any output(stout). How is this possible in bash or python?
Keep cmd.exe open
11,628,345
1
6
5,043
0
python,registry,cmd
Either right-click your script and remove Program->Close on exit checkbox in its properties, or use cmd /k as part of its calling line. Think twice before introducing artificial delays or need to press key - this will make your script mostly unusable in any unattended/pipe calls.
0
1
0
0
2012-07-24T09:23:00.000
5
0.039979
false
11,627,846
1
0
0
2
I have a python script which I have made dropable using a registry-key, but it does not seem to work. The cmd.exe window just flashes by, can I somehow make the window stay up, or save the output? EDIT: the problem was that it gave the whole path not only the filename.
Keep cmd.exe open
11,628,145
1
6
5,043
0
python,registry,cmd
Another possible option is to create a basic TKinter GUI with a textarea and a close button. Then run that with subprocess or equiv. and have that take the stdout from your python script executed with pythonw.exe so that no CMD prompt appears to start with. This keeps it purely using Python stdlib's and also means you ...
0
1
0
0
2012-07-24T09:23:00.000
5
0.039979
false
11,627,846
1
0
0
2
I have a python script which I have made dropable using a registry-key, but it does not seem to work. The cmd.exe window just flashes by, can I somehow make the window stay up, or save the output? EDIT: the problem was that it gave the whole path not only the filename.
Basic Terminal emulation in python
11,698,801
1
4
6,899
0
python,shell,terminal,blender
It seems that you should run it on new control terminal, allocated with "forkpty". To suppress the warning "no job control ...", you need to call "setsid".
0
1
0
0
2012-07-24T15:50:00.000
3
0.066568
false
11,634,626
0
0
0
1
I've been trying to write a basic terminal emulation script, because for some reason i've got no terminal access on my mac. But to write game engine scripts in blender the console, which usually opens in the terminal you started blender with, is crucial. For just doing simple things like deleting, renaming etc. I used ...