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
IO within the Program Files Directory
5,838,105
2
3
1,184
0
python,windows-7,io,uac
I suggest saving the folder in %appdata%\my subdirectory. You won't need administrator privilege for that.
0
1
0
0
2011-04-29T22:28:00.000
4
0.099668
false
5,838,025
0
0
0
3
I made a program that both gathers data from a .txt file by reading it, and writes data to a different .txt file. However, there is a problem. When I run the program in a normal directory It runs perfectly fine. A problem arises when I place it in the C:\Program Files directory. When I run it I get IOERROR: [Errno 13] ...
Open file in Python
5,838,777
0
4
16,048
0
python,django
Use relative paths? ../../../../file
0
1
0
0
2011-04-30T00:54:00.000
4
1.2
true
5,838,735
0
0
0
1
My cwd is ~/Desktop/Development/Python/djcode/mysite, and I want to open a file on my Desktop. What is the syntax to open files in a different directory? (for example, if the file was in the cwd I would use open('file'). Thank you.
Comprehensive beginner's virtualenv tutorial?
13,261,064
35
358
149,425
0
python,virtualenv
Virtualenv is a tool to create isolated Python environments. Let's say you're working in 2 different projects, A and B. Project A is a web project and the team is using the following packages: Python 2.8.x Django 1.6.x The project B is also a web project but your team is using: Python 2.7.x Django 1.4.x The machine...
0
1
0
0
2011-04-30T21:56:00.000
4
1
false
5,844,869
1
0
0
1
I've been hearing the buzz about virtualenv lately, and I'm interested. But all I've heard is a smattering of praise, and don't have a clear understanding of what it is or how to use it. I'm looking for (ideally) a follow-along tutorial that can take me from Windows or Linux with no Python on it, and explain every step...
What should a Window Manager do with a ConfigureRequestEvent?
5,851,984
1
2
848
0
python,x11,window-managers,xcb
The short answer is configure the window (size, stacking, etc.) by calling ConfigureWindow. The long answer is here you impose policy and honor specs such as XSizeHints. Best to have a look at some existing WMs' source and get a sense of what they do. Exactly what you do depends on your desired UI. The simplest thing ...
1
1
0
0
2011-05-01T01:17:00.000
1
0.197375
false
5,845,717
0
0
0
1
For my sins (and for fun the learning experience) I am writing a window manager (I know, I know). I'm using python and XCB (python-xpyb). So far I have figured out that I need to use a SubStructureRedirect mask on the root window(s), and I am successfully being passed events related to applications' top-level windows. ...
how to recover python 2.6.1 that was pre-installed in my macbook pro?
5,846,054
0
0
1,053
0
python
Reinstalling would work. In the future, don't delete Frameworks you didn't install.
0
1
0
0
2011-05-01T02:33:00.000
2
0
false
5,846,022
0
0
0
1
I download python 3.2 and my first thought was that I need to uninstall the python 2.6.1 pre-installed in my computer. But later I found in python.org "You should never modify or delete these, as they are Apple-controlled and are used by Apple- or third-party software". I used "sudo rm -rf /Library/Frameworks/Python.Fr...
How to change default Python version?
50,347,328
2
173
661,274
0
python,macos
Navigate to: My Computer -> Properties -> Advanced -> Environment Variables -> System Variables Suppose you had already having python 2.7 added in path variable and you want to change default path to python 3.x then add path of python3.5.x folder before python2.7 path. open cmd: type "python --version" python version w...
0
1
0
0
2011-05-01T03:10:00.000
19
0.02105
false
5,846,167
1
0
0
6
I have installed Python 3.2 in my Mac. After I run /Applications/Python 3.2/Update Shell Profile.command, it's confusing that when I type Python -V in Terminal it says that Python 2.6.1. How can I change the default Python version?
How to change default Python version?
28,787,350
2
173
661,274
0
python,macos
I am using OS X 10.7.5 and Python 3.4.2. If you type python3 and what you want to run it will run it using python 3. For example pyhton3 test001.py. That ran a test program I made called test001. I hope this helps.
0
1
0
0
2011-05-01T03:10:00.000
19
0.02105
false
5,846,167
1
0
0
6
I have installed Python 3.2 in my Mac. After I run /Applications/Python 3.2/Update Shell Profile.command, it's confusing that when I type Python -V in Terminal it says that Python 2.6.1. How can I change the default Python version?
How to change default Python version?
71,028,281
0
173
661,274
0
python,macos
Starting with macOS Catalina the default shell is zsh. Therefore, all those ~/.bash_profile changes are not going to change the default when you open a new terminal since the new terminal is a zsh shell and not a bash shell. You can confirm your terminal is a zsh shell by typing echo $SHELL and you should see a respons...
0
1
0
0
2011-05-01T03:10:00.000
19
0
false
5,846,167
1
0
0
6
I have installed Python 3.2 in my Mac. After I run /Applications/Python 3.2/Update Shell Profile.command, it's confusing that when I type Python -V in Terminal it says that Python 2.6.1. How can I change the default Python version?
How to change default Python version?
69,782,553
0
173
661,274
0
python,macos
It should be noted that recent versions of Homebrew/MacOS will require a different entry for the PATH as the location where Homebrew installs Python has changed. Add this like to your .zshrc: export PATH="/opt/homebrew/opt/python/libexec/bin:$PATH" This will ensure that the appropriate unversioned python link install...
0
1
0
0
2011-05-01T03:10:00.000
19
0
false
5,846,167
1
0
0
6
I have installed Python 3.2 in my Mac. After I run /Applications/Python 3.2/Update Shell Profile.command, it's confusing that when I type Python -V in Terminal it says that Python 2.6.1. How can I change the default Python version?
How to change default Python version?
67,921,871
-3
173
661,274
0
python,macos
After installing the newer version of python to your computer... When you want to run a python program (e.g. 'program.py') from the terminal (using the latest version of python on your system); instead of running 'python program.py' run 'python3 program.py' Similarly, if you want to use python in the terminal (using th...
0
1
0
0
2011-05-01T03:10:00.000
19
-0.031568
false
5,846,167
1
0
0
6
I have installed Python 3.2 in my Mac. After I run /Applications/Python 3.2/Update Shell Profile.command, it's confusing that when I type Python -V in Terminal it says that Python 2.6.1. How can I change the default Python version?
How to change default Python version?
60,886,499
1
173
661,274
0
python,macos
In short: change the path in Environment Variables! For Windows: Advanced System Settings > Advance (tab). On bottom you'll find 'Environment Variables' Double-click on the Path. You'll see path to one of the python installations, change that to path of your desired version.
0
1
0
0
2011-05-01T03:10:00.000
19
0.010526
false
5,846,167
1
0
0
6
I have installed Python 3.2 in my Mac. After I run /Applications/Python 3.2/Update Shell Profile.command, it's confusing that when I type Python -V in Terminal it says that Python 2.6.1. How can I change the default Python version?
If I open and read the file which is periodically written, can I/O deadlock occur?
12,211,059
0
1
773
1
python,linux,performance,io,deadlock
Quick advice, make sure (like, super sure) that you do close your file. So ALWAYS use a try-except-final block for this Remember that the contens of a final block will ALWAYS be executed, that will prevent you a lot of head pain :)
0
1
0
0
2011-05-01T11:55:00.000
2
0
false
5,848,184
0
0
1
1
In my server process, it looks like this: Main backend processes: Processes Huge list of files and , record them inside MySQL. On every 500 files done, it writes "Progress Report" to a separate file /var/run/progress.log like this "200/5000 files done" It is multi-processed with 4 children, each made sure to run on a ...
Difference between __file__ and sys.argv[0]
5,851,615
7
30
5,521
0
python
It's only the same if you are in the "main" script of your python programm. If you import other files, __file__ will contain the path to that file, but sys.argv will still hold the same values.
0
1
0
0
2011-05-01T21:39:00.000
4
1
false
5,851,588
1
0
0
2
Is there any difference between: __file__ and sys.argv[0] Because both seem to be doing the same thing: they hold the name of the script. If there is no difference, then why is it that __file__ is used in almost all someplaces whereas I have never seen sys.argv[0] being used.
Difference between __file__ and sys.argv[0]
5,851,608
26
30
5,521
0
python
__file__ is the name of the current file, which may be different from the main script if you are inside a module or if you start a script using execfile() rather than by invoking python scriptname.py. __file__ is generally your safer bet.
0
1
0
0
2011-05-01T21:39:00.000
4
1.2
true
5,851,588
1
0
0
2
Is there any difference between: __file__ and sys.argv[0] Because both seem to be doing the same thing: they hold the name of the script. If there is no difference, then why is it that __file__ is used in almost all someplaces whereas I have never seen sys.argv[0] being used.
Best practice to install dependencies?
5,855,669
4
5
3,223
0
python,installation,dependencies
The most important thing to help you decide is to consider your audience. Are they technically-inclined and likely to be comfortable following instructions specifying how to build the dependencies themselves? If so, go with (3). If not, writing a python or shell script, or a makefile to automate the task may be the...
0
1
0
0
2011-05-02T09:33:00.000
2
1.2
true
5,855,543
1
0
0
1
I am thinking of a good way to ship my application which is a python package. Installing my package is easy making use of pythons distutils package. The trouble comes with the dependencies my package relies on. If the dependencies are python packages I can deal with them easily again using distutils, but non python pa...
Is there an advantage to using Bash over Perl or Python?
5,858,924
3
31
26,872
0
python,linux,perl,bash,scripting
If you want to execute programs installed on the machine, nothing beats bash. You can always make a system call from Perl or Python, but I find it to be a hassle to read return values, etc. And since you know it will work pretty much anywhere throughout all of of time...
0
1
0
1
2011-05-02T15:12:00.000
8
0.07486
false
5,858,877
0
0
0
5
Hey I've been using Linux for a while and thought it was time to finally dive into shell scripting. The problem is I've failed to find any significant advantage of using Bash over something like Perl or Python. Are there any performance or power differences between the two? I'd figure Python/Perl would be more well sui...
Is there an advantage to using Bash over Perl or Python?
5,858,956
2
31
26,872
0
python,linux,perl,bash,scripting
The advantage of shell scripting is that it's globally present on *ix boxes, and has a relatively stable core set of features you can rely on to run everywhere. With Perl and Python you have to worry about whether they're available and if so what version, as there have been significant syntactical incompatibilities thr...
0
1
0
1
2011-05-02T15:12:00.000
8
0.049958
false
5,858,877
0
0
0
5
Hey I've been using Linux for a while and thought it was time to finally dive into shell scripting. The problem is I've failed to find any significant advantage of using Bash over something like Perl or Python. Are there any performance or power differences between the two? I'd figure Python/Perl would be more well sui...
Is there an advantage to using Bash over Perl or Python?
5,860,436
4
31
26,872
0
python,linux,perl,bash,scripting
For big projects use a language like Perl. There are a few things you can only do in bash (for example, alter the calling environment (when a script is sourced rather than run). Also, shell scripting is commonplace. It is worthwhile to learn the basics and learn your way around the available docs. Plus there are time...
0
1
0
1
2011-05-02T15:12:00.000
8
0.099668
false
5,858,877
0
0
0
5
Hey I've been using Linux for a while and thought it was time to finally dive into shell scripting. The problem is I've failed to find any significant advantage of using Bash over something like Perl or Python. Are there any performance or power differences between the two? I'd figure Python/Perl would be more well sui...
Is there an advantage to using Bash over Perl or Python?
5,860,163
10
31
26,872
0
python,linux,perl,bash,scripting
bash isn't a language so much as a command interpreter that's been hacked to death to allow for things that make it look like a scripting language. It's great for the simplest 1-5 line one-off tasks, but things that are dead simple in Perl or Python like array manipulation are horribly ugly in bash. I also find that ba...
0
1
0
1
2011-05-02T15:12:00.000
8
1
false
5,858,877
0
0
0
5
Hey I've been using Linux for a while and thought it was time to finally dive into shell scripting. The problem is I've failed to find any significant advantage of using Bash over something like Perl or Python. Are there any performance or power differences between the two? I'd figure Python/Perl would be more well sui...
Is there an advantage to using Bash over Perl or Python?
5,858,911
4
31
26,872
0
python,linux,perl,bash,scripting
The most important advantage of POSIX shell scripts over Python or Perl scripts is that a POSIX shell is available on virtually every Unix machine. (There are also a few tasks shell scripts happen to be slightly more convenient for, but that's not a major issue.) If the portability is not an issue for you, I don't se...
0
1
0
1
2011-05-02T15:12:00.000
8
0.099668
false
5,858,877
0
0
0
5
Hey I've been using Linux for a while and thought it was time to finally dive into shell scripting. The problem is I've failed to find any significant advantage of using Bash over something like Perl or Python. Are there any performance or power differences between the two? I'd figure Python/Perl would be more well sui...
How can I send a user registration confirmation email using Tornado and MongoDB?
7,483,440
6
5
3,734
1
python,email,tornado
I wonder why you would handle registration like that. The usual way to handle registration is: Write the user info to the database, but with an 'inactive' label attached to the user. Send an email to the user. If the user confirms the registration, then switch the user to 'active'. If you don't want to write to the d...
0
1
0
0
2011-05-02T20:41:00.000
2
1
false
5,862,238
0
0
1
1
I'm working with Tornado and MongoDB and I would like to send a confirmation email to the user when he creates an account in my application. For the moment, I use a simple XHTML page with a form and I send information to my MongoDB database using Tornado. I would like to have an intermediate step which sends an email t...
Deploying an app to users' appspot
5,872,643
0
0
193
0
python,google-app-engine
No. Writing an application that deploys other applications is in violation of the terms of service. Note we don't have any 'hard' limits - those limits that aren't billing enabled can be increased on application to us if you provide a reasonable use-case.
0
1
0
0
2011-05-03T05:19:00.000
5
0
false
5,865,349
0
0
1
3
I am working on a Python App, which runs on App Engine. Is there a way I can publish the app on each customers' appSpot account, so that the App uses the users' cloud storage? Instead of running the App on my AppSpot account and all the users storing the data on my Cloud space?
Deploying an app to users' appspot
5,870,645
1
0
193
0
python,google-app-engine
Yes, absolutely. You just need to have each client create an App Engine account with an application to which you have administrator access. You can adjust the settings on the application to forbid downloads of your code by the other administrators if that's appropriate for your agreement with the client. This also allo...
0
1
0
0
2011-05-03T05:19:00.000
5
1.2
true
5,865,349
0
0
1
3
I am working on a Python App, which runs on App Engine. Is there a way I can publish the app on each customers' appSpot account, so that the App uses the users' cloud storage? Instead of running the App on my AppSpot account and all the users storing the data on my Cloud space?
Deploying an app to users' appspot
5,865,451
1
0
193
0
python,google-app-engine
No, you cannot do that. The app is hosted and run in the administrator's account which would be you. What you can do is, release the source code and point your users do install it in their appspot account, just like creating a new application.
0
1
0
0
2011-05-03T05:19:00.000
5
0.039979
false
5,865,349
0
0
1
3
I am working on a Python App, which runs on App Engine. Is there a way I can publish the app on each customers' appSpot account, so that the App uses the users' cloud storage? Instead of running the App on my AppSpot account and all the users storing the data on my Cloud space?
Python changes are not reflected
5,867,954
2
0
900
0
python
I have a example.py file. loaded on a linux server. Many linux servers including Apache and Nginx load the files they need to serve when they start for performance sake. So, you may need to restart the server to pickup the latest python file.
0
1
0
0
2011-05-03T09:47:00.000
1
0.379949
false
5,867,762
0
0
0
1
I have a example.py file. loaded on a linux server. I put some prints in this file and saved it. When I call this .py file I am not getting these changes. Do I need to do something (Like for C we need to compile the .c file and put the .so to LD_LIBRARY_PATH) for python also. Thanks,
Running python from the mac terminal
5,875,841
0
1
9,446
0
python,command-line,terminal
Have a look at the Python package under Applications. There is a shell script there called Update Shell Profile.command Run this and it should set your path up properly. Unless you mark you script as executable with chmod +x, you'll need to run python over it first. e.g. `python myscript.py'
0
1
0
0
2011-05-03T21:15:00.000
5
0
false
5,875,798
0
0
0
4
I have installed the new python release and would like to run .py files from the terminal. How is this done from the terminal? I dont want to include the path in each command to run a .py file.
Running python from the mac terminal
5,876,379
0
1
9,446
0
python,command-line,terminal
I installed all of my python through macports, which has pros and cons. One of the benefits is that you don't have to worry about stuff like this, it just works. You can install python 2.6 and python 2.7 (and others), and then use the python_select utility to set up which python is run when you call "python blah.py"
0
1
0
0
2011-05-03T21:15:00.000
5
0
false
5,875,798
0
0
0
4
I have installed the new python release and would like to run .py files from the terminal. How is this done from the terminal? I dont want to include the path in each command to run a .py file.
Running python from the mac terminal
36,117,645
0
1
9,446
0
python,command-line,terminal
if you add a shebang at the start of the python file then you can run a python file by just its name from terminal add #!/usr/bin/python for mac(others add your respective path for python) at the top of your python program and from your terminal you can run it just by filename(if it has executable permissions).
0
1
0
0
2011-05-03T21:15:00.000
5
0
false
5,875,798
0
0
0
4
I have installed the new python release and would like to run .py files from the terminal. How is this done from the terminal? I dont want to include the path in each command to run a .py file.
Running python from the mac terminal
36,117,693
0
1
9,446
0
python,command-line,terminal
Since you have installed a working python, the easiest way to run python files from the terminal is to cd your terminal to the directory where the file is located and then just type python my_code.py in the terminal.
0
1
0
0
2011-05-03T21:15:00.000
5
0
false
5,875,798
0
0
0
4
I have installed the new python release and would like to run .py files from the terminal. How is this done from the terminal? I dont want to include the path in each command to run a .py file.
Execute a python script stored on a server/network location on a user's local machine using PHP
5,877,854
0
0
937
0
php,python,iis
Is there a way that PHP can execute a python script (stored on Machine A) that is then ran locally (on Machine B) Never. The browsers forbid this kind of security hole.
0
1
0
1
2011-05-04T01:50:00.000
2
0
false
5,877,621
0
0
0
2
I have a webserver running IIS (Machine A) that is running PHP for me. When a user points their browser to a web page that is hosted on the webserver with a PHP script on it, they need to populate a few forms, and then hit a button that will then run the PHP script, which will fire off a python script I've already buil...
Execute a python script stored on a server/network location on a user's local machine using PHP
5,877,648
1
0
937
0
php,python,iis
The question is not exactly clear, but from my understanding, you're trying to execute code on the local user's machine and you can't do that via Python. Your best bet is to write JavaScript that will do the job for you (a few browsers only as you're working with local storage due to HTML5), or you can have your user u...
0
1
0
1
2011-05-04T01:50:00.000
2
0.099668
false
5,877,621
0
0
0
2
I have a webserver running IIS (Machine A) that is running PHP for me. When a user points their browser to a web page that is hosted on the webserver with a PHP script on it, they need to populate a few forms, and then hit a button that will then run the PHP script, which will fire off a python script I've already buil...
Django non blocking email? Downsides to threading.thread or subprocess?
5,877,718
9
5
1,266
0
python,django,multithreading
Offloading the work to some other external process is really the right thing to do, and once you've done it, it's not likely to be the last time you do it. Celery/RabbitMQ is a decent solution, and the nice thing is they're already there. Recent RabbitMQ releases have a decent web-based management app and a decent mana...
0
1
0
0
2011-05-04T01:56:00.000
2
1.2
true
5,877,658
0
0
1
1
I have a django site. Certain actions by the end user send email to the rest of users in a group. When the number of users gets to be > 20 it can add 1-3 seconds to the request cycle, which I don't like. I'd like to be able to send the email from a non-blocking function. I know RabbitMQ and Celery in conjunction ca...
Run python script without the "python" keyword
5,879,906
5
12
8,958
0
python,macos,terminal
Try ./script.py instead of script.py ... or ensure your current directory is in your path and script.py should work....
0
1
0
1
2011-05-04T07:17:00.000
3
0.321513
false
5,879,869
0
0
0
1
How can I run a python script in Terminal on Mac without using the "python" keyword, without having to edit my existing python files? Right now I have to do this: python script.py What I like to do is this: script.py
python create celery task job
5,882,479
1
0
485
0
python,parallel-processing,celery
Giving an example is difficult as messaging is a bit complex, but what you can do basically is: rewrite your program to be a task or write a task that calls your program using subprocess configure celery to have 10 workers execute as many tasks as you need to get your job done, Celery will add them to its queue Celery...
0
1
0
0
2011-05-04T08:49:00.000
1
1.2
true
5,880,867
0
0
0
1
lets say i have a python programm whitch i want to run always max 10 times in parallel using celery / rabbigmq and if some of the process finish i want to know about it so i can start a new process. how can i do so? some examples would be nice
Python: could a script compiled with py2exe freeze the operating system?
5,884,122
0
1
263
0
python,windows,py2exe
A Python program - regardless of whether iterpreted by the Python executable or in py2exe form - can do the same as any other program. That means that it should not be able to freeze a modern operating system unless it is run with superuser rights. However, programs (especially malicious and badly written ones) can sig...
0
1
0
0
2011-05-04T13:17:00.000
2
0
false
5,884,037
1
0
0
2
I am using py2exe to compiling python scripts in executable files on Windows Xp/7/2000. I am wondering if such executable scripts could freeze the operating system, and I have to reboot Windows. I suppose such problems could occur if I try to manage driver library. What do you think about?
Python: could a script compiled with py2exe freeze the operating system?
5,884,075
3
1
263
0
python,windows,py2exe
Theoretically, yes. Windows is not the most stable OS out there, and programs sometime "freeze" it even without mucking with drivers and kernel-mode code. Python programs aren't any different in this respect, whether packed with py2exe or not, since Python programs on Windows easily have access to the same Windows APIs...
0
1
0
0
2011-05-04T13:17:00.000
2
1.2
true
5,884,037
1
0
0
2
I am using py2exe to compiling python scripts in executable files on Windows Xp/7/2000. I am wondering if such executable scripts could freeze the operating system, and I have to reboot Windows. I suppose such problems could occur if I try to manage driver library. What do you think about?
Delete duplicates from GoogleAppEngine Model?
5,890,205
3
4
453
0
python,google-app-engine,google-cloud-datastore,duplicates
Quick? Probably not. If you did want to delete dupes, my approach would be to write a remote_api script. Query the model for all entities, sort by title, and fetch batches of 100. Keep a local Python dictionary of titles. If you encounter a new title, add it to the dictionary. If you encounter a known title, add the en...
0
1
0
0
2011-05-04T21:21:00.000
1
1.2
true
5,890,023
0
0
1
1
I have two Google App Engine Models. I ran my cron's a few times and now there are duplicate entries in my datastore. If it was easy to just delete my entire datastore and upload my data again I would. BUT it took 4 hours to upload last time so I am wondering is there a quick way of deleting entries with duplicate n...
Can I have subprocess.call write the output of the call to a string?
5,902,554
2
22
24,472
0
python,subprocess
subprocess.call() takes the same arguments as subprocess.Popen(), which includes the stdout and stderr arguments. See the docs for details.
0
1
0
0
2011-05-05T18:30:00.000
5
0.07983
false
5,902,485
1
0
0
1
I want to do subprocess.call, and get the output of the call into a string. Can I do this directly, or do I need to pipe it to a file, and then read from it? In other words, can I somehow redirect stdout and stderr into a string?
How to get the environment variables of a subprocess after it finishes running?
5,905,589
1
4
5,121
0
python,environment-variables,subprocess
Can you print them out in the first subprocess and deal with that string in python?
0
1
0
0
2011-05-06T00:25:00.000
5
1.2
true
5,905,574
1
0
0
1
I'm looking for a way to do this, so that I can pass it to the environment of another subprocess.
Listing all USB drives in Linux
70,601,544
0
9
5,051
0
python,linux,usb,removable-storage
This is what I use from bash: lsblk --pairs --nodeps | grep 'RM="1"' Sample output: NAME="sda" MAJ:MIN="8:0" RM="1" SIZE="59.5G" RO="0" TYPE="disk" MOUNTPOINT="" Note it is listing the devices, not its partitions. If you like to see the partitions also, lsblk --pairs | grep 'RM="1"'
0
1
0
0
2011-05-06T12:30:00.000
5
0
false
5,911,445
0
0
0
1
How can I get a list of removable drives (plugged into USB) in Linux? I'm fine with using KDE, GNOME or other DE libraries if it would make things easier.
In Python on Unix, determine if I am using my computer? or idle?
5,914,591
0
8
2,328
0
python,networking,keyboard,python-idle
Stick a webcam on your computer that grabs an image every five seconds, then there's some python modules for image analysis that can check if you are still sitting in your seat. Or get a microswitch wired into your chair, connect that to your PC serial port (or one of those modern USB ports) and read that from Python.....
0
1
1
0
2011-05-06T16:40:00.000
5
0
false
5,914,506
0
0
0
1
I would like to write a script to do an heavy network upload, in the background. However, I would like it to pause when I am using my computer (either by detecting network activity or keyboard activity or that I am not idle). What is the best way to detect that I am using the computer, on Python on Unix?
Can cx-freeze be used in Ubuntu to freeze a python script to a Windows executable?
5,915,297
4
6
1,065
0
python,cx-freeze
You can do that.... but you'll have to install Wine (apt-get install wine) and then install in Wine the windows version of Python and all the python libraries your application needs, and then you'll be able to freeze your script into an exe for windows in your ubuntu box.
0
1
0
0
2011-05-06T17:52:00.000
1
0.664037
false
5,915,151
0
0
0
1
When I use cxfreeze in Ubuntu, it automatically compiles the python script to a Linux executable. I've looked through the documentation extensively, and I can't find a way to freeze the script into a .exe for the purposes of running the program on a Windows machine. Can this be done-?
How to uninstall wxpython 2.8 on Mac OSX 10.6
5,922,093
8
5
4,762
0
python,macos,wxpython,uninstallation
If you look in the .dmg for wxPython, there is an uninstall_wxPython.py unininstall script. Just drag it to your desktop and run python ~/Desktop/uninstall_wxPython.py in a terminal.
1
1
0
0
2011-05-07T11:33:00.000
1
1
false
5,920,764
0
0
0
1
Some details of my machine and installed packages before proceeding further: Mac OSX version: 10.6.6 Python version: Activestate Python 2.7.1 wxpython version: wxpython 2.8 (uses Carbon API hence limited to 32-bit mode arch only) I installed wxPython2.8-osx-unicode-py2.7 from wxpython website using their .dmg installer...
Pyaudio installation error - 'command 'gcc' failed with exit status 1'
5,922,091
42
64
61,454
0
python,linux,gcc,pyaudio
Well, I solved the problem by using the package manager, $ sudo apt-get install python-pyaudio Although still has no clue why easy_install fails.
0
1
0
0
2011-05-07T15:17:00.000
10
1
false
5,921,947
0
0
0
5
I'm running Ubuntu 11.04, Python 2.7.1 and wanted to install Pyaudio. So I ran, $ sudo easy_install pyaudio in the terminal and the process exited with following error messages, Searching for pyaudio Reading http://pypi.python.org/simple/pyaudio/ Reading http://people.csail.mit.edu/hubert/pyaudio/ Best match: pyaudio ...
Pyaudio installation error - 'command 'gcc' failed with exit status 1'
44,772,116
27
64
61,454
0
python,linux,gcc,pyaudio
I install in my virtualenv. pyaudio (0.2.11) pip install pyaudio -> error sudo apt-get install portaudio19-dev -> success pip install pyaudio -> success
0
1
0
0
2011-05-07T15:17:00.000
10
1
false
5,921,947
0
0
0
5
I'm running Ubuntu 11.04, Python 2.7.1 and wanted to install Pyaudio. So I ran, $ sudo easy_install pyaudio in the terminal and the process exited with following error messages, Searching for pyaudio Reading http://pypi.python.org/simple/pyaudio/ Reading http://people.csail.mit.edu/hubert/pyaudio/ Best match: pyaudio ...
Pyaudio installation error - 'command 'gcc' failed with exit status 1'
35,901,952
1
64
61,454
0
python,linux,gcc,pyaudio
I found this question after experiencing a similar error on OpenSuse (13.2). So I figured I'd post my solution as well, in case other people find this via Google. Although libportaudio2 is the package containing the libs, you need portaudio-devel as well to make the installation work.
0
1
0
0
2011-05-07T15:17:00.000
10
0.019997
false
5,921,947
0
0
0
5
I'm running Ubuntu 11.04, Python 2.7.1 and wanted to install Pyaudio. So I ran, $ sudo easy_install pyaudio in the terminal and the process exited with following error messages, Searching for pyaudio Reading http://pypi.python.org/simple/pyaudio/ Reading http://people.csail.mit.edu/hubert/pyaudio/ Best match: pyaudio ...
Pyaudio installation error - 'command 'gcc' failed with exit status 1'
41,717,929
5
64
61,454
0
python,linux,gcc,pyaudio
This is how I get it work: brew update (you can ignore this step if your brew is up to date) brew install portaudio brew link --overwrite portaudio sudo python2.7 -m pip install --global-option='build_ext' --global-option='-I/usr/local/include' --global-option='-L/usr/local/lib' pyaudio
0
1
0
0
2011-05-07T15:17:00.000
10
0.099668
false
5,921,947
0
0
0
5
I'm running Ubuntu 11.04, Python 2.7.1 and wanted to install Pyaudio. So I ran, $ sudo easy_install pyaudio in the terminal and the process exited with following error messages, Searching for pyaudio Reading http://pypi.python.org/simple/pyaudio/ Reading http://people.csail.mit.edu/hubert/pyaudio/ Best match: pyaudio ...
Pyaudio installation error - 'command 'gcc' failed with exit status 1'
64,455,416
2
64
61,454
0
python,linux,gcc,pyaudio
Had the same problem too. I'm working on a MAC and solved the issue by running these lines of code. brew install portaudio pip install pyaudio
0
1
0
0
2011-05-07T15:17:00.000
10
0.039979
false
5,921,947
0
0
0
5
I'm running Ubuntu 11.04, Python 2.7.1 and wanted to install Pyaudio. So I ran, $ sudo easy_install pyaudio in the terminal and the process exited with following error messages, Searching for pyaudio Reading http://pypi.python.org/simple/pyaudio/ Reading http://people.csail.mit.edu/hubert/pyaudio/ Best match: pyaudio ...
How to execute a shell command through Python
27,853,231
1
6
8,218
0
python,shell
subprocess.check_output appears to be the canonical convenience function in Python 2.4+ for executing a command and inspecting the output. It also raises an error if the command returns a non-zero value (indicating an error). Like subprocess.call, check_output is a convenience wrapper around subprocess.Popen, so you m...
0
1
0
0
2011-05-07T16:52:00.000
4
0.049958
false
5,922,590
1
0
0
1
I am new to Python programming. I want to execute a shell command "at" from a Python program. Can any one of the Python gurus help me out? Thanks in advance.
How do I use Python 3.0 under Apache?
5,931,096
1
3
1,328
0
python,windows,apache,python-3.x
Python 3.0 is only supported via CGI. Put your CGI script in cgi-bin\. If you're willing to look at newer versions, preliminary support is available in mod_wsgi (but you'll probably have to build it yourself).
0
1
0
0
2011-05-08T23:06:00.000
3
0.066568
false
5,930,982
0
0
0
1
I've searched for ages on how to use Python 3 under Apache. If there is a walkthrough anywhere, it's very well hidden. Thus, hopefully, one of you Python professionals could make a quick 1-2-3 on how it's done! I'm on Windows 7 using the newest version of XAMPP.
Get Changed Environment Variable in Python
5,935,757
1
2
2,356
0
python
If your process sets/updates an environment variable and then calls the Python script, you would see the updated value in your Python script. But if these are parallel processes and the environment variable gets modified when the Python script is running then the updates to the environemnt variable is not seen in the P...
0
1
0
0
2011-05-09T10:10:00.000
2
0.099668
false
5,935,404
1
0
0
2
I have a requirement where 1 process sets a value as environment variable and I read that value in python using os.environ As per python doc: This mapping is captured the first time the os module is imported, typically during Python startup as part of processing site.py. Changes to the environment made afte...
Get Changed Environment Variable in Python
5,935,419
3
2
2,356
0
python
I guess you can use os.getenv() to get the value of an environment variable any time, and this will reflect the most up-to-date state. Update: note that there is no such thing as one "global" environment, at least not on Linux. Quoting Wikipedia: In all Unix and Unix-like systems, each process has its own private set ...
0
1
0
0
2011-05-09T10:10:00.000
2
1.2
true
5,935,404
1
0
0
2
I have a requirement where 1 process sets a value as environment variable and I read that value in python using os.environ As per python doc: This mapping is captured the first time the os module is imported, typically during Python startup as part of processing site.py. Changes to the environment made afte...
mac snow leopard setuptools stick to MacOSX10.4u.sdk when trying to install python-mysql
5,936,425
0
0
358
1
python,mysql,macos,osx-snow-leopard,compilation
Check your environment for CFLAGS or LDFLAGS. Both of these can include the -isysroot argument that influences the SDK selection. The other place to start at is to look at the output of python2.6-config --cflags --ldflags since (I believe) that this influences the Makefile generation. Make sure to run easy_install w...
0
1
0
0
2011-05-09T10:58:00.000
1
1.2
true
5,935,910
0
0
0
1
when I try to install python-mysql today, I got a number of compilation error or complaining /Developer/SDKs/MacOSX10.4u.sdk not found, like the following: running build running build_py copying MySQLdb/release.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb running build_ext building '_mysql' extension Compiling with ...
Resolve mac address by host name
5,936,797
0
1
2,670
0
python,perl,ip,mac-address,hostname
The ethers file on a UNIX system maps Ethernet address to IP-number (or hostname). If your /etc/ethers is properly maintained, you can look it up in there.
0
1
0
1
2011-05-09T12:20:00.000
2
0
false
5,936,781
0
0
0
1
I've wrote several perl scripts during my internship, and I would like to simplify the use of them. The scripts asks in arg, a mac address, and returns which switch is connected, speed...etc. Instead of giving a mac address, I would like to give a host name of a computer. So, how can I resolve the hostname to mac addre...
What are some good examples of processes to automate for a python beginner to start with?
5,945,001
1
1
117
0
python,linux,command-line
What you want to automate depends on what you are doing manually and what your role is ? If you are a system administrator (say) and if you have shell scripts written to automate some of the tasks (like server management, user account creation etc.) you can port them to Python.
0
1
0
0
2011-05-10T03:14:00.000
1
1.2
true
5,944,764
1
0
0
1
Trying to get some initial bearings on useful processes that a basic working knowledge of python can assist with or make less tedious. Specifically, processes that can be executed on the command line in a Linux environment. An example or two of both the tedious process as well as sample code to use as a starting point ...
How do I upload an entire directory to S3?
5,959,764
9
3
3,211
0
python,file,amazon-web-services,amazon-s3
Install S3 (http://s3tools.org/download) Configure it: s3cmd --configure Create a bucket: s3cmd mb s3://my-bucket (alternatively, you can do this via a tool like S3Fox) Sync your local directory with S3: s3cmd sync /path/to/local/dir/ s3://my-bucket
0
1
0
0
2011-05-10T05:07:00.000
1
1.2
true
5,945,408
0
0
0
1
I want my directory, and all its sub directories and files, to go straight to S3. Clone it. Is there an easy script/program to do that? I'm on Ubuntu linux.
Google App Engine : alternate method of get_by_id()
5,989,456
1
1
814
0
python,google-app-engine
The problem disappear by itself after the 2011-05-10, which is the v1.5 launch date. Not sure this problem is related. I didn't change any code, as the get_by_id() was fine all the while and on this few days. Beside, I added a cron job to run the get_by_id() every minutes and try to get the instance alive. From my obse...
0
1
0
0
2011-05-10T06:41:00.000
4
1.2
true
5,946,170
0
0
1
3
By given an entity ID , I will query by models = Model.get_by_id(id). However, I find out that some time it will not return result collectly. Is there any alternative or recommended method to query by entity ID in Google App Engine, python?
Google App Engine : alternate method of get_by_id()
5,949,477
3
1
814
0
python,google-app-engine
If Model.get_by_id(id) returns None, this indicates that you've supplied an invalid ID, not that the method itself is unreliable. It's not inconceivable that this method could fail in the event of a system outage, but if it did, your call would throw a datastore exception, not return an empty result.
0
1
0
0
2011-05-10T06:41:00.000
4
0.148885
false
5,946,170
0
0
1
3
By given an entity ID , I will query by models = Model.get_by_id(id). However, I find out that some time it will not return result collectly. Is there any alternative or recommended method to query by entity ID in Google App Engine, python?
Google App Engine : alternate method of get_by_id()
5,946,313
0
1
814
0
python,google-app-engine
get_by_id() always get the object, if the passed object is a valid id of object and if the objects exists in the datastore. id can be got by object.key.id in the templat else you always have the object.get(key).
0
1
0
0
2011-05-10T06:41:00.000
4
0
false
5,946,170
0
0
1
3
By given an entity ID , I will query by models = Model.get_by_id(id). However, I find out that some time it will not return result collectly. Is there any alternative or recommended method to query by entity ID in Google App Engine, python?
Send Data From Flex to Python (GAE)
5,948,044
1
0
181
0
python,apache-flex,google-app-engine,google-cloud-datastore
Have flex send a request to the Python server. COuld be a form post or JSON data or whatever.
0
1
0
0
2011-05-10T09:05:00.000
3
1.2
true
5,947,727
0
0
1
1
I'm working on a project that runs off Google App Engine (Python) which stores various user details inside GAE's datastore. I have Flex content which users can use and once done the Flex app needs to send data to the Python backend to 'mark' the user off for that task. Any suggestions?
Secure python web app
5,947,923
0
0
517
0
python,security,web-applications
Easiest and most secure: Put Apache or Nginx in front of it with an HTTPS proxy. Update: Or VPN access as suggested by Jakob. Good idea.
0
1
0
1
2011-05-10T09:16:00.000
2
1.2
true
5,947,849
0
0
1
2
i have python web app build on top of BaseHTTPServer, which runs on specyfic port. It runs system commands and shows output. I want do limit access to this app. What are posible ways to do it? Requirements: it must not be limited to LAN simple to implement/deploy
Secure python web app
5,947,916
0
0
517
0
python,security,web-applications
Common methods: VPN access. Firewalls, logging, denyhosts style defences, complicated root passwords, no su, run as its own user. (if it was my personal server) Logic bombs
0
1
0
1
2011-05-10T09:16:00.000
2
0
false
5,947,849
0
0
1
2
i have python web app build on top of BaseHTTPServer, which runs on specyfic port. It runs system commands and shows output. I want do limit access to this app. What are posible ways to do it? Requirements: it must not be limited to LAN simple to implement/deploy
determining URL that forwarded
5,951,213
1
1
199
0
python,google-app-engine,url
If by forwarding you mean HTTP redirection, you can check the Referer header. If you mean DNS resolving (e.g. distinguishing between your application being invoked via your own domain and .appspot.com one), there is SERVER_NAME environment variable (os.environ["SERVER_NAME"]) that stores the domain (e.g. www.example.co...
0
1
0
0
2011-05-10T13:44:00.000
3
0.066568
false
5,951,035
0
0
1
1
I have a series of different domain names that I would like to all point (via URL forwarding from my domain host) to a google app engine application that reads what the forwarding URL is. So if the domain typed in was original XYZ.com, then when I am forwarded to my application, I can return what that original domain n...
How to know the system is Debian or CentOS in Python?
5,952,044
3
6
1,337
0
python,debian,centos,yum,apt
If you just need to know whether to use yum or apt, one approach is simply to pick one of those commands and try it. If it works, it works; if not, catch the exception and try the other command.
0
1
0
1
2011-05-10T14:49:00.000
2
0.291313
false
5,951,930
0
0
0
1
I want to write some install scripts by python, it should know the OS to choose either apt command or yum command. It seems sys.platform can tell 'win32' or the others, but how to know it is working on Debian or CentOS in Python?
Get content from open window in Linux
5,961,317
4
1
1,235
0
python,linux,window-managers
I think the correct answer may be "with some difficulty". Essentially, the contents of a window is a bitmap. This bitmap is drawn on by a whole slew of primitives (including "display this octet-string, using that encoding and a specific font"), but the window contents is still "just pixels". Getting the "just pixels" i...
0
1
0
0
2011-05-11T07:05:00.000
3
0.26052
false
5,960,483
0
0
0
1
I want to collect data and parse it eventually from an open window in linux. An example- Suppose a terminal window is open. I need to retrieve all the data that appears on that window. After retrieval, I would parse it to get specific commands entered. So is it possible to do that? If so, how? I would prefer to use pyt...
check if a file is 'complete' (with python)
5,967,726
1
3
6,644
0
python,macos,file-io
It seems like you have control of the (python?) program doing the copying. What commands are you using to copy? I would think writing your code such that it blocks until the copy operation is complete would be sufficient. Is this program multi-threaded or processed? If so you could add file paths to a queue when they a...
0
1
0
1
2011-05-11T16:23:00.000
6
0.033321
false
5,967,521
0
0
0
2
is it possible to check if a file is done copying of if its complete using python? or even on the command line. i manipulate files programmatically in a specific folder on mac osx but i need to check if the file is complete before running the code which makes the manipulation.
check if a file is 'complete' (with python)
5,967,724
2
3
6,644
0
python,macos,file-io
If you know where the files are being copied from, you can check to see whether the size of the copy has reached the size of the original. Alternatively, if a file's size doesn't change for a couple of seconds, it is probably done being copied, which may be good enough. (May not work well for slow network connections,...
0
1
0
1
2011-05-11T16:23:00.000
6
1.2
true
5,967,521
0
0
0
2
is it possible to check if a file is done copying of if its complete using python? or even on the command line. i manipulate files programmatically in a specific folder on mac osx but i need to check if the file is complete before running the code which makes the manipulation.
Troubleshoot python daemon that quits unexpectedly?
5,969,373
1
4
2,169
0
python,strace
I would generally start by adding logging to it. At a minimum, have whatever is launching it capture stdout/stderr so that any stack traces are saved. Examine your except blocks to make sure you're not capturing exceptions silently.
0
1
0
1
2011-05-11T19:08:00.000
3
0.066568
false
5,969,337
0
0
0
1
What's the best way to monitor a python daemon to determine the cause of it quitting unexpectedly? Is strace my best option or is there something Python specific that does the job?
Two Python instances, same libraries
5,982,042
4
2
113
0
python,linux,libraries
You should be able to install the files to an external location and define the environment variable PYTHONPATH to point to the directory that contains the modules.
0
1
0
0
2011-05-12T17:26:00.000
2
1.2
true
5,981,933
1
0
0
2
I currently have both Python 2.6 and 2.7 running on my Linux machine. Now, from Python 2.7, I can't access the libraries that I installed through package manager for Python 2.6. I tried uninstalling the library and installing it back with Python 2.7 installed as my default runtime. No luck. How can I share libraries be...
Two Python instances, same libraries
5,982,011
0
2
113
0
python,linux,libraries
You should have now both a /usr/lib/python2.6 folder and a /usr/lib/python2.7. Try creating links inside the 2.7 folders to the required files or folders inside the 2.6 folder.
0
1
0
0
2011-05-12T17:26:00.000
2
0
false
5,981,933
1
0
0
2
I currently have both Python 2.6 and 2.7 running on my Linux machine. Now, from Python 2.7, I can't access the libraries that I installed through package manager for Python 2.6. I tried uninstalling the library and installing it back with Python 2.7 installed as my default runtime. No luck. How can I share libraries be...
asynchronous file upload with ajaxupload to a tornado web server
5,989,216
2
3
1,836
1
python,file-upload,tornado,ajax-upload
I got the answer. I need to use self.request.body to get the raw post data. I also need to pass in the correct _xsrf token, otherwise tornado will fire a 403 exception. So that's about it.
0
1
0
0
2011-05-12T19:00:00.000
1
1.2
true
5,983,032
0
0
1
1
I'm using this javascript library (http://valums.com/ajax-upload/) to upload file to a tornado web server, but I don't know how to get the file content. The javascript library is uploading using XHR, so I assume I have to read the raw post data to get the file content. But I don't know how to do it with Tornado. Their ...
Linux user scheme for a Django production server
5,986,912
2
6
925
0
python,django,linux,nginx,uwsgi
I like having regular users on a system: multiple admins show up in sudo logs -- there's nothing quite like asking a specific person why they made a specific change. not all tasks require admin privileges, but admin-level mistakes can be more costly to repair it is easier to manage the ~/.ssh/authorized_keys if each f...
0
1
0
0
2011-05-13T01:51:00.000
1
1.2
true
5,986,472
0
0
1
1
I'm currently trying to set up nginx + uWSGI server for my Django homepage. Some tutorials advice me to create specific UNIX users for certain daemons. Like nginx user for nginx daemon and so on. As I'm new to Linux administration, I thought just to create second user for running all the processes (nginx, uWSGI etc.), ...
does C has anything like python pickle for object serialisation?
5,987,204
4
2
207
0
python,c
An emphatic NO on that one, I'm afraid. C has basic file I/O. Any structuring of data is up to you. Make up a format, dump it out, read it in. There may be libraries which can do this, but by itself no C doesn't do this.
0
1
0
0
2011-05-13T04:19:00.000
3
1.2
true
5,987,185
0
1
0
2
I'm wondering if C has anything similar to the python pickle module that can dump some structured data on disk and then load it back later. I know that I can write my structure byte by byte to a file on disk and then read it back later, but with this approach there's still quite some work to do. For example, if I have...
does C has anything like python pickle for object serialisation?
5,987,230
2
2
207
0
python,c
The C library functions fread(3) and fwrite(3) will read and write 'elements of data', but that's pretty fanciful way of saying "the C library will do some multiplication and pread(2) or pwrite(2) calls behind the scenes to fill your array". You can use them on structs, but it is probably not a good idea: holes in the...
0
1
0
0
2011-05-13T04:19:00.000
3
0.132549
false
5,987,185
0
1
0
2
I'm wondering if C has anything similar to the python pickle module that can dump some structured data on disk and then load it back later. I know that I can write my structure byte by byte to a file on disk and then read it back later, but with this approach there's still quite some work to do. For example, if I have...
Python: tool to keep track of deployments
5,988,654
1
5
332
0
python,deployment,web-deployment
pip freeze gives you a listing of all installed packages. Bonus: if you redirect the output to a file, you can use it as part of your deployment process to install all those packages (pip can programmatically install all packages from the file). I see you're already using virtualenv. Good. You can run pip freeze -E myv...
0
1
0
0
2011-05-13T06:41:00.000
2
0.099668
false
5,988,177
0
0
1
1
I'm looking for a tool to keep track of "what's running where". We have a bunch of servers, and on each of those a bunch of projects. These projects may be running on a specific version (hg tag/commit nr) and have their requirements at specific versions as well. Fabric looks like a great start to do the actual deployme...
Installing modules for multiple python versions
5,991,416
3
4
4,579
0
python,python-module,multiple-versions
You can use easy_install. To use it for particular version, you just execute it like for example sudo python2.5 easy_install package_name.
0
1
0
0
2011-05-13T11:27:00.000
2
1.2
true
5,991,193
1
0
0
1
I have installed python 2.6.6 and python 2.5.5 on the same machines (Ubuntu 10.0.4), since 2.6 is my default version and 2.5 I need for maintaining old stuff. But I have a problem to install modules(MySQLdb and net-snmp) to non-default 2.5v. It seems that only 2.6 is updated when 'sudo apt-get install _module_name_' is...
amqp exchange types
7,130,213
0
0
356
0
python,amqp,kombu
For most people it is best to just use a topic exchange for everything until you fully understand how AMQP works. You can get fanout and direct behavior just by choosing the right binding key for a queue. For instance if you use "#" for a binding key, then that queue behaves as if it was connected to a direct exchange....
0
1
0
0
2011-05-13T23:18:00.000
1
1.2
true
5,998,693
0
0
0
1
I'm getting into the whole amqp thing and i have a question regarding which type of exchange type to use under the following scenario's: 1) i have the need to create a worker pool where each worker does something when they receive a message. now i want different workers attached to different types of tasks; which i can...
Porting python-twisted based code to scala: framework advice needed
9,134,732
2
7
975
0
python,scala,twisted,akka,scalaz
Finagle seems to be modeled closely after, or at least accidentally similar, to twisted. twitter.util.Future looks a lot like twisted's Deferred. So I'm using it for the moment.
0
1
0
0
2011-05-15T11:30:00.000
1
1.2
true
6,008,107
0
0
0
1
I am trying to port a significant amount of code written in python with twisted to scala, and I'm looking for opinions on what framework combination to choose. The thing is essentially an RPC (custom protobuf-based + xmlrpc)/HTTP server and client, that does some database-keeping and transformations but later sends dow...
How do I detect a socket disconnection? / How do I call socket.recv with a timeout?
6,010,876
2
4
5,998
0
python,sockets,networking,gevent
it's not detecting the disconnection because there wasn't any disconnection, the TCP "connection" is still alive and suppose to be reliable. if for example you unplug your LAN cable, and the re-plug it, the connection will still work. if you really want to detect the disconnection ASAP, then i guess you should just par...
0
1
1
0
2011-05-15T15:35:00.000
2
0.197375
false
6,009,365
0
0
0
1
I'm using gevent patched socket to connect to a streaming server and I'm using an adsl connection. I don't control the server but in my tests, if I stop the server I can detect the disconnection by just checking if the result from recv is an empty string, but if I turn off my adsl modem recv never exits. If I just dis...
Do I need to update the watch when new sub-folder add in the monitor folder
6,039,032
2
2
181
0
python,pyinotify
And I find that there is an parameter auto_add in function add_watch, which can auto add the directory in the watch when it is created. But it need the event IN_CREATE.
0
1
0
0
2011-05-16T08:35:00.000
2
0.197375
false
6,014,836
0
0
0
2
I have watch a folder that will create a new sub-folder use date as name(e.g 201105124) everyday. I have start a daemon to watch it but if a new sub-folder added, the event in the new sub-folder cannot be trigger. IS that I need to update the watch for the new folder? Thx for your answer. Regards Roy
Do I need to update the watch when new sub-folder add in the monitor folder
6,015,129
0
2
181
0
python,pyinotify
Yes, you need to use update_watch after directory creation.
0
1
0
0
2011-05-16T08:35:00.000
2
1.2
true
6,014,836
0
0
0
2
I have watch a folder that will create a new sub-folder use date as name(e.g 201105124) everyday. I have start a daemon to watch it but if a new sub-folder added, the event in the new sub-folder cannot be trigger. IS that I need to update the watch for the new folder? Thx for your answer. Regards Roy
How to prevent termination of a running program using "ctrl+c" in Linux using python?
6,019,234
0
4
838
0
python,command-line,keyboard-shortcuts
If using X, the text is normally copied to the clipboard once it's selected. Just paste it using middle mouse button or Shift+insert.
0
1
0
0
2011-05-16T14:52:00.000
3
0
false
6,019,192
0
0
0
1
I have written a piece of code in python, in which I am asking questions and users should give their input. Sometimes, these questions are difficult for the user to understand(they are non-english). So most of the time they want to copy paste the sentence into google translate. However, since this code is running in th...
Is there a way to determine if a Linux PID is paused or not?
6,021,798
4
7
2,298
0
python,linux,process,controls,pid
call ps and check the STAT value. D Uninterruptible sleep (usually IO) R Running or runnable (on run queue) S Interruptible sleep (waiting for an event to complete) T Stopped, either by a job control signal or because it is being traced. W paging (not valid since the 2.6.xx kernel) X dead (should neve...
0
1
0
1
2011-05-16T18:35:00.000
3
0.26052
false
6,021,771
0
0
0
1
I have a python script that is using the SIGSTOP and .SIGCONT commands with os.kill to pause or resume a process. Is there a way to determine whether the related PID is in the paused or resumed state?
IDE for Python: test a script
6,024,347
3
0
110
0
python,ide
In absence of some other file based config, you could just keep the variable definitions in a a file that you import in the main script (e.g, config.py), then have two different versions of that file for 'on' and 'off' network, (or ' development' and 'production', whatever) with the appropriate settings. No IDE needed...
0
1
0
1
2011-05-16T21:00:00.000
1
1.2
true
6,023,377
0
0
0
1
Is there any IDE that allows to run a script in testing mode, allowing to replace at runtime, some values, like a folder or else? I have a program that will have to run on a network i have no access to where I develop. Since it will use some specific folders to pick up files, I was wondering if i.e. I could use an IDE ...
making python interpreter open in same window
6,401,182
0
1
1,148
0
emacs,buffer,python-mode
I use python-mode 5.2.0. I went into python-mode.el and changed the switch-to-buffer-other-window to switch-to-buffer. I evaluated it and now the interpreter opens up in the same window (regardless of the number of other windows I have). Did you evaluate the function when you changed the above line? Btw, opening the in...
0
1
0
0
2011-05-17T01:27:00.000
2
0
false
6,025,305
1
0
0
1
Maybe I'm being irrational but I really really hate it when a command opens a new window in emacs. I'm using emacs on Ubuntu which came with python-mode and when I start an interpreter with C-c ! it pops up in a new window. What I want is for emacs to switch to a new buffer in the same window. So far I've tried addin...
Plone 4.0.5 unified installer failing on Ubuntu 11.04 (natty) with zip/zlib error
6,056,817
2
5
5,914
0
python,ubuntu,plone,zlib
Instructing the Unified Installer to build its own zlib works: ./install.sh --libz=yes zeo
0
1
0
0
2011-05-17T12:39:00.000
5
0.07983
false
6,030,876
0
0
0
2
I am a Plone newbie and am trying to install Plone 4.0.5 on Ubuntu 11.04 Natty using the Unified Installer. I unpack the installer and run the ./install.sh zeo as root and I get the following error: ZEO Cluster Install selected Detailed installation log being written to /tmp/Plone-4.0.5-UnifiedInstaller/install.log ...
Plone 4.0.5 unified installer failing on Ubuntu 11.04 (natty) with zip/zlib error
6,044,639
1
5
5,914
0
python,ubuntu,plone,zlib
Note that if you have an acceptable Python on your system already (or can install one), you may use "--with-python=/path/to/Python-2.6" on the install.sh command line.
0
1
0
0
2011-05-17T12:39:00.000
5
0.039979
false
6,030,876
0
0
0
2
I am a Plone newbie and am trying to install Plone 4.0.5 on Ubuntu 11.04 Natty using the Unified Installer. I unpack the installer and run the ./install.sh zeo as root and I get the following error: ZEO Cluster Install selected Detailed installation log being written to /tmp/Plone-4.0.5-UnifiedInstaller/install.log ...
Can python freeze be made to compile 32 bit binaries on a 64 bit linux
6,045,613
1
0
362
0
python,linux,32bit-64bit,freeze
Could you use something likemake CFLAGS="-m32".?
0
1
0
0
2011-05-18T13:29:00.000
1
0.197375
false
6,045,515
1
0
0
1
I've a number of python scripts that I am likely to need to distribute to users who may have minimal x86 linux setups and no guarantees of having python or a particular version of it. My desktop is an x86-84 architecture setup, but I am able to cross compile 32 bit elf's with GCC. The python freeze script is currently ...
File handle leaking (maybe) in a C library makes trouble with NFS (+python, but that's incidental)
6,052,579
1
2
368
0
python,file,nfs,resource-leak
The kernel keeps track of file descriptors, so even if you got python to unload the .so and release the memory, it would not know to close the leaked file descriptors. The only thing that comes to mind is importing the .so after forking, and only cleaning up after the forked child process has exited (and the file handl...
0
1
0
0
2011-05-18T16:36:00.000
2
0.099668
false
6,048,046
1
0
0
1
here is a quite cool problem. I have a python script (main) that calls a python module (foo.py) which in turns calls another python module (barwrapper.py) uses LoadLibrary to dynamically open and access a libbar.so library. libbar and the whole rest of the chain open and create files to perform their task. The problem...
ipython and fork()
6,218,845
0
7
1,506
0
python,fork,process,ipython
In Linux terminology, instead of forking the iPython process, why don't you exec a regular python interpreter from the iPython shell and have that one fork?
0
1
0
0
2011-05-18T19:02:00.000
2
0
false
6,049,741
1
0
0
1
I am planning a Python script that'll use os.fork() to create a bunch of child processes to perform some computations. The parent process will block until the children terminate. The twist is that I need to be able to run the script both from the Unix shell using python and from ipython using %run. In what manner shoul...
routing a only specific traffic through a vpn connection via python
6,058,965
0
4
2,644
0
python,vpn
Python itself can't be used to route traffic; though you can use it to execute system commands to change your routing table. If you're on Linux, you need to use the ip command from the iproute2 and iptables from netfilter to change the routing behavior of specific traffic.
0
1
1
0
2011-05-19T12:47:00.000
2
0
false
6,058,818
0
0
0
2
Is there any method to connect to vpn through python and have that traffic of that application only route through the said VPN?
routing a only specific traffic through a vpn connection via python
41,357,041
0
4
2,644
0
python,vpn
Please, be more specific in your question. Generally, yes, it is possible. If you use python 2.7 or newer, you can use source_address option for http connections (see reference for libraries you use) as tuple ('interface address', port). If you use sockets in your app, use socket.bind(('interface address', port)) on cr...
0
1
1
0
2011-05-19T12:47:00.000
2
0
false
6,058,818
0
0
0
2
Is there any method to connect to vpn through python and have that traffic of that application only route through the said VPN?
Quick Sending of 4[GB] To Be Processed From 100 Machines?
6,062,779
1
10
423
0
python,nosql,distributed-computing
Can you write your code using a Python binding to MPI? MPI has facility for over the wire data transmission from M nodes to N nodes, M,N>=1. Also, as mentioned above you could write the data to 100 files on a shared filesystem, then read the files on the 'master' node.
0
1
0
0
2011-05-19T17:19:00.000
5
0.039979
false
6,062,396
0
0
0
4
I have 100 servers in my cluster. At time 17:35:00, all 100 servers are provided with data (of size 1[MB]). Each server processes the data, and produces an output of about 40[MB]. The processing time for each server is 5[sec]. At time 17:35:05 (5[sec] later), there's a need for a central machine to read all the output ...
Quick Sending of 4[GB] To Be Processed From 100 Machines?
6,063,128
2
10
423
0
python,nosql,distributed-computing
What's your networking setup ? If your central machine is connected to the cluster by a single gigabit link, it's going to take you at least ~30s to copy the 4GByte to it (and that's assuming 100% efficiency and about 8s per gigabyte, which I've never seen).
0
1
0
0
2011-05-19T17:19:00.000
5
0.07983
false
6,062,396
0
0
0
4
I have 100 servers in my cluster. At time 17:35:00, all 100 servers are provided with data (of size 1[MB]). Each server processes the data, and produces an output of about 40[MB]. The processing time for each server is 5[sec]. At time 17:35:05 (5[sec] later), there's a need for a central machine to read all the output ...
Quick Sending of 4[GB] To Be Processed From 100 Machines?
6,064,685
5
10
423
0
python,nosql,distributed-computing
Look at the flow of data in your application, and then look at the data rates that your (I assume shared) disk system provides and the rate your GigE interconnect provides, and the topology of your cluster. Which of these is a bottleneck? GigE provides theoretical maximum 125 MB/s transmission rate between nodes - thus...
0
1
0
0
2011-05-19T17:19:00.000
5
1.2
true
6,062,396
0
0
0
4
I have 100 servers in my cluster. At time 17:35:00, all 100 servers are provided with data (of size 1[MB]). Each server processes the data, and produces an output of about 40[MB]. The processing time for each server is 5[sec]. At time 17:35:05 (5[sec] later), there's a need for a central machine to read all the output ...
Quick Sending of 4[GB] To Be Processed From 100 Machines?
6,087,129
2
10
423
0
python,nosql,distributed-computing
Experiment! Other answers have included tips on what to experiment with, but you might solve the problem the most straight-forward way and use that as your baseline. You have 1meg producing 40meg of output on each server - experiment with each server compressing the data to be sent. (That compression might be free-ish ...
0
1
0
0
2011-05-19T17:19:00.000
5
0.07983
false
6,062,396
0
0
0
4
I have 100 servers in my cluster. At time 17:35:00, all 100 servers are provided with data (of size 1[MB]). Each server processes the data, and produces an output of about 40[MB]. The processing time for each server is 5[sec]. At time 17:35:05 (5[sec] later), there's a need for a central machine to read all the output ...
Google App Engine Versioning in the Datastore
6,063,370
7
15
1,749
0
python,google-app-engine,google-cloud-datastore
Datastore has no concept of versions. When you update a model definition, any entities you create in the future will be of the new type, and the old ones will be of the old type. This frequently leads to runtime errors if your code is not aware of these changes.
0
1
0
0
2011-05-19T18:35:00.000
2
1
false
6,063,286
0
0
1
1
Google App Engine has the concept of app versions. i.e., you can have multiple versions of your app running concurrently and accessible at different subdomains. For instance: http://1.my-app-name.appspot.com, http://2.my-app-name.appspot.com. What aspects of the app are actually "versioned" by this? Is it only the Pyth...
redirecting system call output in python
6,074,155
0
0
624
0
python,redirect,pipe,system-calls
Python as build-in functionality like os.listdir() or os.walk() for listing stuff on the filesystem. Running 'ls' yourself is very bad-style. In general look at the documentation of the subprocess module giving you all flexibility for interacting with external commands.
0
1
0
0
2011-05-20T15:20:00.000
2
0
false
6,074,034
1
0
0
1
I wish to execute os.system('ls') in python. the return value of this statement is an error code integer..but I want to get the contents of the present directory as a string. How to accomplish this?
Compiling Python 2.6.6 and need for external packages wxPython, setuptools, etc... in Ubuntu
6,079,512
-1
2
2,035
0
python,ipython,ld,rpath,tcmalloc
If you compiled 2.6.6 and installed 2.6.5 from the repos, then ubuntu is having a conflict in finding what python you're using. I'm flagging this to move to Superuser.
0
1
0
0
2011-05-21T01:57:00.000
3
-0.066568
false
6,079,128
1
0
0
1
I compiled Python 2.6.6 with google-perf tools (tcmalloc) library to eliminate some of the memory issues I was having with the default 2.6.5. After getting 2.6.6 going it seems to not work becuase I think having issues with the default 2.6.5 install in Ubuntu. Will none of the binaries installed from the software chann...
How to get the size of tar.gz in (MB) file in python
6,080,484
2
13
28,504
0
python,linux,file-io
Use the os.stat() function to get a stat structure. The st_size attribute of that is the size of the file in bytes.
0
1
0
1
2011-05-21T08:10:00.000
5
0.07983
false
6,080,477
1
0
0
1
I am doing backups in python script but i need to get the size of tar.gz file created in MB How can i get the size in MB of that file