Title
stringlengths
15
150
A_Id
int64
2.98k
72.4M
Users Score
int64
-17
470
Q_Score
int64
0
5.69k
ViewCount
int64
18
4.06M
Database and SQL
int64
0
1
Tags
stringlengths
6
105
Answer
stringlengths
11
6.38k
GUI and Desktop Applications
int64
0
1
System Administration and DevOps
int64
1
1
Networking and APIs
int64
0
1
Other
int64
0
1
CreationDate
stringlengths
23
23
AnswerCount
int64
1
64
Score
float64
-1
1.2
is_accepted
bool
2 classes
Q_Id
int64
1.85k
44.1M
Python Basics and Environment
int64
0
1
Data Science and Machine Learning
int64
0
1
Web Development
int64
0
1
Available Count
int64
1
17
Question
stringlengths
41
29k
How do I make a python script executable?
66,843,453
1
72
145,067
0
python,command-line
The simplest way that comes to my mind is to use "pyinstaller". create an environment that contains all the lib you have used in your code. activate the environment and in the command window write pip install pyinstaller Use the command window to open the main directory that codes maincode.py is located. remember to keep the environment active and write pyinstaller maincode.py Check the folder named "build" and you will find the executable file. I hope that this solution helps you. GL
0
1
0
0
2014-12-15T23:03:00.000
6
0.033321
false
27,494,758
1
0
0
2
How can I run a python script with my own command line name like 'myscript' without having to do 'python myscript.py' in the terminal?
py launcher does not find my Python 2.7
27,523,478
10
6
21,363
0
python,installation
I found the solution. The registry had wrong entries. As I have a 32 bit version installed I went to HKEY_LOCAL_MACHINE|HKEY_CURRENT_USER\SOFTWARE\wow6432node\Python\PythonCore\2.7\InstallPath and the value was set to C:\Python27 while my installation is in D:\Python27. So I changed all the registry values to match the correct location and it now works fine. It's been quite a while I installed Python 2.7, but I assume I had Python 2.7 installed first. Then I deleted it and installed pythonxy in this new location. I probably didn't uninstall the previous version correctly.
0
1
0
0
2014-12-16T10:55:00.000
4
1.2
true
27,503,003
1
0
0
1
I'm on Windows 7. I have Python 2.7 installed for years. I installed recently Python 3.4. I'm trying to use the new py launcher. When I open the cmd terminal and type py -2, I get this error message: Requested Python version (2) not installed. How can make py aware of my python 2.7 installation? Note: python 2.7 is installed in a non-standard directory (not in C:\Python27), in case this is the problem.
Backup in one and restore in another Google App Engine application by using Cloud Storage?
34,706,288
4
8
961
1
python,google-app-engine
Yes!! What you are trying to do is not possible. The reason is that there are absolute references in the backup files to the original backup location (bucket). So moving the files to another GCS location will not work. Instead you have to leave the backup files in the original GCS bucket and give your new project read access to that folder. That is done in the "Edit bucket permissions" option. eg. add: Project - owners-12345678 - Reader Now you are able to import from that bucket in your new project in "Import Bucket Information".
0
1
0
0
2014-12-16T22:17:00.000
2
0.379949
false
27,514,985
0
0
1
2
My goal was to duplicate my Google App Engine application. I created new application, and upload all needed code from source application(python). Then I uploaded previously created backup files from the Cloud Storage of the source application (first I downloaded those files to PC and than uploaded files to GCS bucket of the target app) After that I tried to restore data from those files, by using "Import Backup Information" button. Backup information file is founded and I can add it to the list of available backups. But when I try to do restore I receive error: "There was a problem kicking off the jobs. The error was: Backup not readable" Also I tried to upload those files back to original application and I was able to restore from them, by using the same procedure, so the files are not corrupted. I know there are another methods of copying data between applications, but I wanted to use this method. If for example, my Google account is being hacked and I can not access my original application data, but I have all backup data on my hard drive. Then I can simply create new app and copy all data to the new app... Has anyone before encountered with the similar problem, and maybe found some solution? Thanks!
Backup in one and restore in another Google App Engine application by using Cloud Storage?
29,852,870
1
8
961
1
python,google-app-engine
Given the message, my guess is that the target application has no read access to the bucket where the backup is stores. Add the application to the permitted users to that bucket before creating the backup so that the backup objects will inherit the permission.
0
1
0
0
2014-12-16T22:17:00.000
2
0.099668
false
27,514,985
0
0
1
2
My goal was to duplicate my Google App Engine application. I created new application, and upload all needed code from source application(python). Then I uploaded previously created backup files from the Cloud Storage of the source application (first I downloaded those files to PC and than uploaded files to GCS bucket of the target app) After that I tried to restore data from those files, by using "Import Backup Information" button. Backup information file is founded and I can add it to the list of available backups. But when I try to do restore I receive error: "There was a problem kicking off the jobs. The error was: Backup not readable" Also I tried to upload those files back to original application and I was able to restore from them, by using the same procedure, so the files are not corrupted. I know there are another methods of copying data between applications, but I wanted to use this method. If for example, my Google account is being hacked and I can not access my original application data, but I have all backup data on my hard drive. Then I can simply create new app and copy all data to the new app... Has anyone before encountered with the similar problem, and maybe found some solution? Thanks!
Python console not launching properly from command line
27,557,706
0
1
632
0
python,windows,command-line,command
Issue resolved. Since no feasible solution was found in 2 days, I decided to wipe all keys containing 'python' from registry as well as some files that were not parts of other programs. This resolved the issue after re-installing python. If anyone finds the true cause of this misbehavior and other - less brutal - solution, please write it here for future reference.
0
1
0
0
2014-12-17T02:05:00.000
2
0
false
27,517,255
1
0
0
1
I seem to have problem launching python from command line. I tried various things with no success. Problem: When trying to run python from the command line, there is no response i.e. I do not get message about 'command not found' and console does not launch. Only option to open python console is to run C:\Python34\python.exe directly. Running using python command does not work even when in the python directory but python.exe launches. Issue with the launching this way is that python console is launched in new window. This whole problem is present only on one machine while on my other machine I am able to run python correctly and console launches in the command prompt window from which the python command was executed. PATH is correctly set to C:\Python34\;C:\Python34\Scripts;... and where python correctly returns C:\Python34\python.exe. I verified that running other commands imported through PATH (such as javac) run correctly. Things I tried: Completely re-installing python both with x86 and x64 python installations with no success. Copy installation from my second machine and manually set the path variables - again no success. Can anyone hint how to resolve this behavior? (Additional info: Win 8.1 x64, python 3.4.2)
Is there any way to use Google Protobuf on pypy?
27,687,619
1
2
567
0
python,c++,protocol-buffers
So this is a happy non-answer using my experience. The pure-python bindings for google protobuf are a terrible port of C/C++ stuff. However, I had quite a bit of success wrapping C google protobuf generated bindings using cffi. Someone should go ahead and create a more generic binding, but that would just a short consulting stint.
1
1
0
1
2014-12-17T03:40:00.000
1
0.197375
false
27,517,939
0
0
0
1
Protobuf with pure python performance 3x slowly on pypy than CPython do. So I try to use c++ implementation for pypy. These are two error (PyFloatObject undefined and const char* to char*) when I compile protobuf(2.6.1 release) c++ implementation for pypy. I compile successfully after I modify python/google/protobuf/pyext/message.c,But I get 'Segmentation fault' error finally when I use protobuf with c++ implementation on pypy. I don't know how to fix it, help me please!
Completion of App Engine Index Writes (Python)
27,540,122
1
1
45
0
python,google-app-engine,google-cloud-datastore
No, it is done asynchronously and you are not able to control this process. Hooks available only for by key gets, not for index queries. Try to build your datastore with parent-child relationships, so you can do ancestor queries, they are always consistent.
0
1
0
0
2014-12-17T10:13:00.000
1
1.2
true
27,523,124
0
0
1
1
Is there a way to know / detect if an object (after being put to the datastore) has been written to an index i.e. object would be visible in a relevant query? Maybe something like a hook method? Thanks!
Multiple Time Zones in Google Appengine Cron Job
27,530,878
3
0
571
0
python,google-app-engine,cron
You can schedule a cron job to run every hour, because every hour there is 9 am somewhere.
0
1
0
0
2014-12-17T15:19:00.000
1
0.53705
false
27,528,859
0
0
1
1
I want to schedule a task for 9:00 AM in every country. (basically 9:00 AM in every time zone). How can I schedule that in google appengine? Will it take multiple timezones for time zone parameter? Thanks in advance
Keyboard emulation in python, cross platform
28,269,358
0
0
509
0
python,scripting,hotkeys,hid
Uinput is the definitive, Kernel-guru sanctioned way to do this on Linux. Thanks to @Reily Grant for the Mac info!
0
1
0
0
2014-12-18T03:03:00.000
1
1.2
true
27,538,582
0
0
0
1
I couldn't find a way to do this on Mac and Linux. With Windows one could use ctypes and then use console.SendKeys. So far as I can tell there is certainly no way that Apple would let a humble user take over the mouse and keyboard, but how might an average Joe do this on Linux? Despite no findings, I would assume there is some way to do this through an X-server? Any input, in any programming language, is very welcome
Jenkins: How to push build artifacts back to source control?
27,594,747
1
0
620
0
python,svn,jenkins
I'd not do this. There isn't an OOTB solution as this would generally be seen as a terrible idea - committing on at least two levels: 1. committing derived artifacts is sub-optimal 2. committing binaries is sub-optimal However if I absolutely had too I'd setup a job that did the binary commit that shared the same workspace as the compile job. I'd' have the commit job triggered on success of the compile - this job could run your script (python, or a simple bash build step that invokes svn cli. Be sure to set the compile job to block when downstream job is building, you wouldn't want the binaries changing during the commit.
0
1
0
0
2014-12-19T06:48:00.000
1
0.197375
false
27,561,003
0
0
0
1
Is there any OOTB way to get a post build step to push the results of a Jenkins build back to a (Subversion) repository? We use one repository for sources and another to record the binaries for every commit to trunk (very useful for debugging). The Jenkins pull on the source SVN repository change works perfectly, the build step is fine, but now we need the 'what next' step. A Python script to handle the push back to SVN is easy enough to write providing it can find the build result details but how best to integrate this with Jenkins? I see some posts/plugins about GIT, but not so much about SVN. Failing a plugin for the job I'll hook in a post-build script using the postbuild-task plugin.
ERROR: 'ogr2ogr' is not recognized as an internal or external command, operable program or batch file when running ogr2ogr in python script
27,570,551
0
0
1,962
1
python-2.7,subprocess
REINSTALLING the python bindings resolved my issue. I don't see GDAL on the paths below but its working now. Is it supposed to be there so since its not, I might probably have another round of GDAL head scratching in the future? ::::::::::::::::::::::::::::::::::::::: THIS is what I currently have when I type in sys.path on python: Microsoft Windows [Version 6.2.9200] (c) 2012 Microsoft Corporation. All rights reserved. C:\Users\User>python Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. import sys sys.path ['', 'C:\windows\SYSTEM32\python27.zip', 'C:\Python27\DLLs', 'C:\Python27\lib', 'C:\Python27 \lib\plat-win', 'C:\Python27\lib\lib-tk', 'C:\Python27', 'C:\Python27\lib\site-packages', ' C:\Python27\lib\site-packages\wx-3.0-msw']
0
1
0
0
2014-12-19T13:48:00.000
1
0
false
27,567,450
0
0
0
1
I get an error when trying to run ogr2ogr thru subprocess but I am able to run it using just the windows command prompt. The script will be part of a series of processes that start with batch importing gpx files unto a postgres db. Can somebody please tell me what's wrong? Thanks! :::::::::::::::::::::::::::: Running THIS script gives me an ERROR: 'ogr2ogr' is not recognized as an internal or external command, operable program or batch file. import subprocess import sys print sys.executable track= "20131007.gpx" subprocess.call(["ogr2ogr", "-f", "PostgreSQL", "PG:dbname=TTBASEMain host=localhost port=5432 user=postgres password=minda", track], shell=True) ::::::::::::::::::::::::::::: THIS CODE does its job well. ogr2ogr -f PostgreSQL PG:"dbname='TTBASEMain' host='localhost' port='5432' user='postgres' password='minda'" "20131007.gpx" ::::::::::::::::::::::::::::: THIS is what I have in my environment path: C:\Users\User>path PATH=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine C omponents\IPT;C:\Program Files\Lenovo\Bluetooth Software\;C:\Program Files\Lenovo\Bluetooth Software\syswow64;C:\lastools\bin;C:\Python27;C:\Python27\Scripts;C:\Python27\DLLs;C:\Python27\Lib\site-packages;C:\Users\User\AppData\Roaming.local\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\GDAL
Changing between Python 2.x and 3.x in windows CMD?
27,572,488
3
4
6,850
0
python,windows,cmd
You'll have to make changes to the PATH environmental variable. To do this, click the Start button, right click on "Computer", hit "Properties", click "Advanced System Settings" in the left sidebar. Then click the Environmental Variables button. Under User or System variables, there will be a variable called "PATH" that includes a path to you Python installation. You can change this to the Python 3 install path. You can also change the name of the Python 3 executable to "python3.exe", and add the directory to the path variable, separating it from other directories with a semicolon. Then you can use both 2 and 3 by calling python and python3 respectively.
0
1
0
0
2014-12-19T19:04:00.000
3
0.197375
false
27,572,366
1
0
0
2
I have both Python 2.7 and 3.4 installed on my Windows Machine. When I type Python in CMD it defaults to Python2.7. How do I switch to 3.4?
Changing between Python 2.x and 3.x in windows CMD?
33,028,953
2
4
6,850
0
python,windows,cmd
Simply changing the name of the python.exe to anything (ex:pytoioion.exe) in your C:/Python34 or C:/Python27 will switch between the two versions. To verify, run this on your command prompt C:Users/(your_name)>python
0
1
0
0
2014-12-19T19:04:00.000
3
0.132549
false
27,572,366
1
0
0
2
I have both Python 2.7 and 3.4 installed on my Windows Machine. When I type Python in CMD it defaults to Python2.7. How do I switch to 3.4?
Installing modules with PyPM on ActiveState
27,667,123
2
0
320
0
python,ssh,paramiko,activestate,pypm
I feel really foolish. After reading that paramiko has replaced ssh module there still is an ssh module available. Ooops!!
0
1
0
1
2014-12-26T19:25:00.000
1
1.2
true
27,661,082
0
0
0
1
I am new to python scripting and started to look into a script to allow me to SSH to a box and check it is still running. I have installed ActiveState (Python 2.7) on my windows desktop. Using PyPM I have installed paramiko and pycrypto but when I try to execute my scripts I get the following error: Script: python C:\Python27\Scripts\RunOnEnv\ssh-matic.py Error:ImportError:no Modules named ssh When passing: '>>>help('modules') I can not see ssh in the list. I have tried uninstalling and installing the modules with no problems. What else am I missing?
Where To Test Python Code
27,664,945
0
0
629
0
python,terminal,ide
As soon as you don't mess up with the system files, you might not do any damages. Be sure what files you might be disturbing. If your code is too, ummmm, core, try to give ideone.com a try. This might help you with the things you might b touching. Terminal might not give you enough interactions, but as you told that you are new to coding, terminal is important. Get along with it. Find error without syntax highlighting feature. It will definitely help in the future. But yes, this is applicable if you are going for it seriously, gradually.
0
1
0
1
2014-12-27T05:55:00.000
1
1.2
true
27,664,809
1
0
0
1
I get slightly nervous posting in here because these are not my waters yet. Please bear with, I am very new to the world of code. I do my best to find answers to questions before I ask them; time is very valuable so I appreciate yours. When I run code under Python in Terminal do I run the risk of damaging my system if I run bad code? My guess is no but I'd rather ask than regret. To follow up that question is there an editor that includes a built in interpreter so that I can write code and see it interpreted in the same window? Or is the best practice to write in an editor and run it in Terminal? Since syntax highlighting isn't available in Terminal I'm assuming that writing in Terminal is less than efficient. Thank you for your help.
Public Client App Port Forwarding with OpenShift
27,665,587
0
0
211
0
python,c++,linux,openshift,openshift-client-tools
all the 'rhc port-forward appname' does is set up SSH tunnels behind the scenes. If you want people to tunnel into your appication you will need to get their public SSH key into your application as an approved key. Then you can set up an SSH tunnel whatever way you chose.
0
1
0
1
2014-12-27T06:12:00.000
1
1.2
true
27,664,896
0
0
0
1
I'm trying to test and distribute my python application in script or executable form (client). I already have my openshift server setup and running. I'm confused on setting up port forwarding with other users to test it out with. Do other clients (publicly) need to download rhc and run 'rhc port-forward appname' on their own machine or are there alternatives out there which can be accomplished using python internally by code? This is kind of confusing and any help would be much appreciated. Thanks.
How to open files from a very large folder quickly?
27,667,551
0
1
516
0
python,file,ntfs
This is a problem of the underlying file system. Use a file system that is better suited for large amount of files. Built a directory tree, sort the files into directories after the first, second, third ... character of the filename.
0
1
0
0
2014-12-27T13:06:00.000
2
0
false
27,667,517
0
0
0
1
I have a folder with about 220,000 text files. I need to open them in a certain order, and do something with the content. At the moment, I just use open, and it takes, on average, about half a second to open a file. Is there any faster way to do it? If it matters - I'm on Windows.
How to compile linux application into win *.exe file
27,685,003
-1
0
257
0
python,linux,windows,ubuntu,exe
if you can't get the python to run on windows a packaged exe version is impossible.
0
1
0
0
2014-12-29T07:17:00.000
2
-0.099668
false
27,684,920
1
0
0
1
I have python program that I've been writing on Ubuntu. For some reasons I could not properly installed on windows few libraries that I used, there are some problems I can't solve in libraries. I used PyInstaller to build run file in Ubuntu. And it is works perfectly. But now I faced a problem, I need to run this application on windows. And it specifically need to be an exe file, so I would not need to install ubuntu vmware on every PC in which I use this app. So is there any solution to compile/convert run file to exe?
Should I delete temporary files created by my script?
27,708,677
3
2
1,430
0
python,bash,shell,operating-system,temp
As a general rule, you should remove the temporary files that you create. Recall that the $TEMP directory is a shared resource that other programs can use. Failure to remove the temporary files will have an impact on the other programs that use $TEMP. What kind of impacts? That will depend upon the other programs. If those other programs create a lot of temporary files, then their execution will be slower as it will take longer to create a new temporary file as the directory will have to be scanned on each temporary file creation to ensure that the file name is unique. Consider the following (based on real events) ... In years past, my group at work had to use the Intel C Compiler. We found that over time, it appeared to be slowing down. That is, the time it took to run our sanity tests using it took longer and longer. This also applied to building/compiling a single C file. We tracked the problem down. ICC was opening, stat'ing and reading every file under $TEMP. For what purpose, I know not. Although the argument can be made that the problem lay with the ICC, the existence of the files under $TEMP was slowing it and our development team down. Deleting those temporary files resulted in the sanity checks running in less than a half hour instead of over two--a significant time saver. Hope this helps.
0
1
0
1
2014-12-29T13:51:00.000
2
1.2
true
27,690,197
1
0
0
1
It's a common question not specifically about some language or platform. Who is responsible for a file created in systems $TEMP folder? If it's my duty, why should I care where to put this file? I can place it anywhere with same result. If it's OS responsibility, can I forgot about this file right after use? Thanks and sorry for my basic English.
Python network communication with encryption and password protection
27,719,872
0
0
595
0
python,encryption,https
if you have no problem rolling out a key file to all nodes ... simply throw your messages into AES, and move the output like you moved the unencrypted messages ... on the other side ... decrypt, and handle the plaintext like the messages you handled before ...
0
1
0
1
2014-12-31T10:20:00.000
2
1.2
true
27,719,695
0
0
0
1
I want to create a python program that can communicate with another python program running on another machine. They should communicate via network. For me, it's super simple using BasicHTTPServer. I just have to direct my message to http:// server2 : port /my/message and server2 can do whatever action needed based on that message "/my/message". It is also very time-efficient as I do not have to check a file every X seconds or something similar. (My other idea was to put text files via ssh to the remote server and then read that file..) The downside is, that this is not password protected and not encrypted. I would like to have both, but still keep it that simple to transfer messages. The machines that are communicating know each other and I can put key files on all those machines. I also stumbled upon twisted, but it looks rather complicated. Also gevent looks way too complicated with gevent.ssl.SSLsocket, because I have to check for byte length of messages and stuff.. Is there a simple example on how to set something like this up?
How to `pip install` a package that has non-Python dependencies?
27,735,671
1
35
4,418
0
python,pip
For most popular packages, There is a workaround for recent ubuntu systems. For example, I want to install matplotlib. When you order pip install matplotlib, it usually fails because of a missing dependency. You can use apt-get install python-matplotlib instead. For python3, you can use apt-get install python3-matplotlib
0
1
0
0
2015-01-01T19:44:00.000
2
0.099668
false
27,734,053
1
0
0
1
Many python packages have build dependencies on non-Python packages. I'm specifically thinking of lxml and cffi, but this dilemma applies to a lot of packages on PyPI. Both of these packages have unadvertised build dependencies on non-Python packages like libxml2-dev, libxslt-dev, zlib1g-dev, and libffi-dev. The websites for lxml and cffi declare some of these dependencies, but it appears that there is no way to do figure this out from a command line. As a result, there are hundreds of questions on SO that take this general form: pip install foo fails with an error: "fatal error: bar.h: No such file or directory". How do I fix it? Is this a misuse of pip or is this how it is intended to work? Is there a sane way to know what build dependencies to install before running pip? My current approach is: I want to install a package called foo. pip install foo foo has a dependency on a Python package bar. If bar build fails, then look at error message and guess/google what non-Python dependency I need to install. sudo apt-get install libbaz-dev sudo pip install bar Repeat until bar succeeds. sudo pip uninstall foo Repeat entire process until no error messages. Step #4 is particularly annoying. Apparently pip (version 1.5.4) installs the requested package first, before any dependencies. So if any dependencies fail, you can't just ask pip to install it again, because it thinks its already installed. There's also no option to install just the dependencies, so you must uninstall the package and then reinstall it. Is there some more intelligent process for using pip?
Set aliases in bash.bashrc
27,763,299
0
0
853
0
python,bash,cygwin,alias
The error indicate that the bash.bashrc file was not loaded. Check these: The bashrc filename is usually .bashrc / .bash_profile and it's in the user's home directory. Or it should exists as /etc/bash.bashrc. The file is not loaded automatically, restart the shell to load it.
0
1
0
0
2015-01-04T07:01:00.000
2
0
false
27,763,265
1
0
0
1
When I try to set aliases, I get two different results using two different methods. I'm using cygwin. METHOD 1: In cygwin I execute the following: alias python='/cygdrive/c/python27/python.exe' python <name of python file> ...and it runs just fine, as expected METHOD 2: In my bash.bashrc file I add the following line: alias python='/cygdrive/c/python27/python.exe' python <name of python file> ...and I get the following error: :no such file or directoryython.exe Just two questions: What is the difference between these two methods? Why is one causing and error and one is not? Thanks <3
Google Drive / App Engine for Document Management System
27,791,624
0
1
1,208
0
google-app-engine,google-drive-api,document-management,google-apps-for-education,google-app-engine-python
Since you'll be building your own software, the answer to "will it do what I want" is always "yes, eventually". You'll need to make a decision about document formats, which in turn will influence your indexing mechanism. Specifically, you have two primary options:- convert the files to Google document formats (doc, spreadsheet, etc). You will then be able to use Google's own indexing and search, eg. as you would from drive.gogle.com. The downside is that formatting may be lost during the import/export round trip. keep the documents in their native format (eg. MS .docx), and perform your own indexing. This will require parsing each document type, which is non-trivial, but I'm sure there are third party libraries to assist. The upside is that the documents you retrieve are the identical documents you imported. I think I would look at doing both of the above. Thus when you import a file into your DMS you store it twice into Google Drive, converted and unconverted. Use App Engine datastore to keep track of the pairings. This way you can use the Drive search to find the converted document, but the file you serve back to the user is its unconverted twin.
0
1
0
0
2015-01-05T19:53:00.000
1
1.2
true
27,786,842
0
0
1
1
I administer a University's document management system. The system is a 3rd party that integrates with another 3rd party database that acts as our ERP system. The DMS is quite clunky and has a wide array of terrible bugs / lacks features & support. I've been playing around with Google App Engine / Drive SDK in my free time out of curiosity. Since we are a Google Apps for Education customer, we have unlimited drive space and all our users are Google apps users. Would it be feasible to internally build a web application (potentially powered by Google App Engine) that utilizes the Drive SDK to manage all the university's files (~ 6 TB). From my experimenting it seems to have all the capabilities required.
Python development in Windows
27,790,624
0
0
139
0
python,windows
Any good programmer's text editor will do. I personally use SublimeText 3, but I've used Eclipse + PyDev before to great success, and the usual suspects (emacs, vim, Notepad++) will work just fine too.
0
1
0
0
2015-01-06T00:16:00.000
4
0
false
27,790,165
1
0
0
1
I've been writing and using short Python scripts (~100 lines) for various tasks in Ubuntu using the Geany text editor, which I like for it's simplicity (setup, F5 to run, etc.) and syntax highlighting. I would like to know if there is a similar application for Windows. Because what I've found so far requires downloading 3 different applications or using a big IDE like eclipse.
How can I get the PORT number when using Nginx + Tornado?
27,880,443
0
0
96
0
python,nginx,tornado
Each of these ports is a different python process, right? At some point you must be passing in the port number to each process and calling app.listen(port) (or one of the related bind/listen methods). Just save the port number at that time (could just be a global variable if you only have one server per process)
0
1
0
0
2015-01-08T08:06:00.000
1
1.2
true
27,835,528
0
0
1
1
Nginx make PORT 8000:8003 to Tornado server.py I want to get the PORT number in MainHanlder and print it in the browser when someone visit my site. And I don't want to make several copies of server.py to server8000.py, server8001.py, ..., I want just one main entrance to solve this problem. How can I do it?
Python34.dll is missing
34,793,148
0
2
13,987
0
python,dll,cython
Just installed PyInstaller - it has the option to compile to one file.
1
1
0
0
2015-01-08T22:48:00.000
2
0
false
27,850,953
1
0
0
1
I had created an application in Python and then I tried to make an executable from it. Works well in Ubuntu and Windows but only when on this system I have Python installed. In other case (Tried only for Win) I get the error that "The application can't start because python34.dll is missing" What I do (filename is curr.py, also I have icon.res for icon): python C:\Python34\Scripts\cython-script.py --embed curr.py in curr.c replace wmain by main (without doing it app won't be compiled at all) gcc curr.c -o curr.exe -IC:\Python34\include -LC:\Python34\libs icon.res -lpython34 -mwindows --static Of course, If I copy python34.dll to the app's folder everything is OK. Do I have another way?
Accessing windows registry Python
27,867,537
1
0
230
0
python,windows,registry
Fixed it be deleting python 32 bit and installing python 64 bit, works like a charm
0
1
0
0
2015-01-09T18:21:00.000
1
1.2
true
27,866,775
1
0
0
1
I am stuck here trying to make a python script to access windows registry. My issue is that I get an error file not found using the following path: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged" It works until NetworkList and afterwards it just returns the error of file not found. I tried using different folders in the directory NetworkList but it gives error file not found for any of them. Using ragedit I can see that the directories that I am trying to access do exist. Any ideas?
pip install: Please check the permissions and owner of that directory
57,711,516
0
156
189,575
0
python,pip,sudo,osx-yosemite
If you altered your $PATH variable that could also cause the problem. If you think that might be the issue, check your ~/.bash_profile or ~/.bashrc
0
1
0
0
2015-01-09T22:05:00.000
5
0
false
27,870,003
1
0
0
2
While installing pip and python I have ran into a that says: The directory '/Users/Parthenon/Library/Logs/pi' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag. because I now have to install using sudo. I had python and a handful of libraries already installed on my Mac, I'm running Yosemite. I recently had to do a clean wipe and then reinstall of the OS. Now I'm getting this prompt and I'm having trouble figuring out how to change it Before my command line was Parthenon$ now it's Philips-MBP:~ Parthenon$ I am the sole owner of this computer and this is the only account on it. This seems to be a problem when upgrading to python 3.4, nothing seems to be in the right place, virtualenv isn't going where I expect it to, etc.
pip install: Please check the permissions and owner of that directory
39,810,683
61
156
189,575
0
python,pip,sudo,osx-yosemite
pip install --user <package name> (no sudo needed) worked for me for a very similar problem.
0
1
0
0
2015-01-09T22:05:00.000
5
1
false
27,870,003
1
0
0
2
While installing pip and python I have ran into a that says: The directory '/Users/Parthenon/Library/Logs/pi' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag. because I now have to install using sudo. I had python and a handful of libraries already installed on my Mac, I'm running Yosemite. I recently had to do a clean wipe and then reinstall of the OS. Now I'm getting this prompt and I'm having trouble figuring out how to change it Before my command line was Parthenon$ now it's Philips-MBP:~ Parthenon$ I am the sole owner of this computer and this is the only account on it. This seems to be a problem when upgrading to python 3.4, nothing seems to be in the right place, virtualenv isn't going where I expect it to, etc.
how to setup virtualenv to use a different python version in each virtual env
27,885,868
1
0
572
0
python,virtualenv,virtualenvwrapper
When creating virtual environment, you can specify which python to use. For example, virtualenv -p/usr/bin/python2.7 env Same for mkvirtualenv
0
1
0
0
2015-01-11T09:36:00.000
1
0.197375
false
27,885,666
1
0
0
1
using autoenv and virtualenvwrapper in python and trying to configure in it the specific python version. the autoenv file (called .env) contains (simply) echo 'my_env' is there a way to configure it's python version?
When I try to run ipython on powershell, I get the error "Failed to create process"
35,580,619
1
2
1,609
0
python-2.7,ipython
I had this problem on Windows after I had 2 version of Python installed. Even after I uninstalled one version of Python through Control Panel, the folder C:\Python2.7 still existed. After I deleted this folder manually, ipython started work normally.
0
1
0
0
2015-01-12T01:20:00.000
3
0.066568
false
27,894,077
1
0
0
3
I installed pythonxy (2.7.9), but when I try to run ipython from windows powershell, I get an error "failed to create process." What steps can I take to solve this problem. Thanks,
When I try to run ipython on powershell, I get the error "Failed to create process"
42,178,769
1
2
1,609
0
python-2.7,ipython
Go to cmd and type where iPython. if it results in two locations, delete one and proceed with other. Usually this happens when you have installed Anaconda distribution after installing python in your local system. Deleting python version locally would be a better solution. And then go to the root folder, (Ex: C:\Users\Desktop\new_folder), by holding shift, click right button and go to open command prompt here. Type iPython. This should solve your problem.
0
1
0
0
2015-01-12T01:20:00.000
3
0.066568
false
27,894,077
1
0
0
3
I installed pythonxy (2.7.9), but when I try to run ipython from windows powershell, I get an error "failed to create process." What steps can I take to solve this problem. Thanks,
When I try to run ipython on powershell, I get the error "Failed to create process"
42,316,996
0
2
1,609
0
python-2.7,ipython
You can also rename folders, for example C:\Python27_ , so that they are not found. This way you don't have to delete your libraries! Then you remove the underscore depending on the project you are working in. Make sure you have the relevant directories in the path, otherwise the version you do want won't be found at all. Sorry of this sounds silly, but after painlessly failing to setup virtualenv in Windows, this solution comes in handy for having multiple Python installations.
0
1
0
0
2015-01-12T01:20:00.000
3
0
false
27,894,077
1
0
0
3
I installed pythonxy (2.7.9), but when I try to run ipython from windows powershell, I get an error "failed to create process." What steps can I take to solve this problem. Thanks,
Is it bad to use the built-in python on mac?
27,895,907
1
0
1,327
0
python,macos,python-2.7,python-3.x,pillow
You can use the built-in Python, there's nothing "bad" about it. If someday you run into some limitation (unlikely), you can always switch then.
0
1
0
0
2015-01-12T05:32:00.000
2
1.2
true
27,895,863
1
0
0
1
I started learning python on a PC, by installing Python 3, and so when I switched to mac I thought "Look at that, you can just type idle in the terminal and there's Python 2, let me just use that," not wanting to have to deal with two versions on the same machine. However, I read that it's recommended to install a newer version of Python and not to mess up with the built-in install. Is it a bad practice to use the built-in version? For the matter, I'm not a heavy programmer, just like to play with Python every now and then. The only extra module I've installed was Pillow.
How can I send mail via Python on Yosemite... without an outside server?
27,913,491
0
1
291
0
python,email,osx-yosemite
adding this an answer cause not enough space in comments. It might work, but highly unlikely, and if you can send outbound mail, it will most likely be spam folder'd or dropped. The reason most apps use a dedicated mail server or smart host is that there are lots of other things that need to be setup besides the mail server (DNS records, SPF, DKIM,etc..). By default it if type sendmail user@example.com on your mac, type your message and end it with a . on a line by itself you mac will try to deliver it using its internal server(postfix). It will look up the Right Hand Side, look for MX records, try to connect to port 25 on the lowest order mx, and do all the things that a mail server does when delivering email. But if your skunk work project cannot access gmail on port 465 or 587 due to firewall settings, then there is very little chance that your mail admins will allow it to connect to random servers on port 25 (since this is exactly what Direct to MX Bots/Malware do). You best bet is to contact your admins and tell them you have an application that needs to send email, (low volume, notification type, whatever), and ask them if they have an approved server that you can smart host via. Going around network security, even with the best of intentions, is generally a bad idea. Since the rules are generally put in place for a reason
0
1
0
1
2015-01-12T19:36:00.000
1
1.2
true
27,909,442
0
0
0
1
I have set up an unused Macbook Pro as a shared server on our internal company intranet. I'm kind of running it as a skunkworks; it can access the internet, but doesn't have permission to access, say, Gmail via SMTP. It's also unlikely to get that access anytime soon. I'd like to be able to run processes on the machine that send notification emails. Every library I can find seems to require an email server, and I can't access one. Is there any way to set up my MBP to act as its own email server? Thanks.
How to show realtime results of multiple python scripts in 1 window
27,957,366
0
0
40
0
python,python-2.7
This is a shot in the dark, I haven't done much python, but could you not have your background scripts dump their results in a file and then have your window focus on updating when that file updates. In linux you could write to a text file and then open another console window to tail that file.
0
1
0
0
2015-01-15T05:30:00.000
1
1.2
true
27,957,335
1
0
0
1
I need to run several python scripts simultaneously in the background, and have all the results be shown in 1 window, real time. The background scripts will continue running, but as more info is outputted it should be shown inside 1 window. I've tried os and subprocess, but to no avail. This needs to work on all platforms.
scons - delete some of the built files after the compilation process
28,020,565
0
0
408
0
python,c++,swig,scons
It seems like using the "Delete" function as a Command, after the SharedLibrary line, allows me to delete the unwanted files.
0
1
0
0
2015-01-16T11:59:00.000
1
1.2
true
27,983,493
1
0
0
1
I have a scons setup where I can choose to run SWIG and build a python module from c++. this creates files such as x_wrap.cc x.lib x.obj etc. When all I want to have at the end of the process are theses files: _x.pyd x.py Is there a way I can get scons to delete the unwanted files after the build process?
How to get WXpython 2.8 on Ubuntu?
27,988,300
2
0
2,485
0
python,ubuntu,wxpython
Run this: sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n
0
1
0
0
2015-01-16T16:13:00.000
3
0.132549
false
27,988,150
0
0
0
1
I'm using python and anaconda to work on some code, which turns out to requires wx2.8, but all I can find is installer for wx3.0. I looked into it, and the process for building an older version of wx from source is very unclear. It's not as simple as python setup.py install for example. Does anyone have experience with this, or at least can provides some reading on the matter that they know for a fact works? I'm also not using my system python, so I can't do sudo apt-get install (unless you can specify the python installation path in such a way).
Gspread and python on windows mobile or windows CE
28,018,470
0
0
151
0
python,windows-mobile,windows-ce,gspread
Although gspread source code is available and a python modul it depends on urllib and that depends on various other modules that are not part of PythonCE. So, I fear, you will not success in getting gspread running on the windows mobile device. Best solution to this seems to use a web server that hosts the html pages. Apache, for example, can host python code. OTOS gspread is a warpper for google spread sheet API that can be invoked directly from html javascript code running on windows mobile device. But does a spread sheet make sense on such small displays?
0
1
0
0
2015-01-17T03:46:00.000
1
1.2
true
27,995,942
0
0
0
1
I am working on an inventory project for work that will use a mobile computer and have run into a problem. I have written a program using Python and the Gspread library, but forgot to check if it will even work with either the windows mobile or windows CE operating systems. From what I have found there is a version of python for Windows CE but I am not sure if the Gspread library even works with this version of python. Has anybody had any experience working with these operating systems or does somebody have a better understanding of python and its libraries? can I just install a library into any version of python?
How do I deploy a python application to an external server?
28,012,820
-1
0
452
0
python,deployment,packaging
Just turn your computer into a server. Simply set up your router for port forwarding so that your server's content's will display when the router's IP is entered. You can of course purchase a DNS domain to give that IP a human readable URL.
0
1
0
0
2015-01-18T17:44:00.000
2
-0.099668
false
28,012,791
1
0
0
1
I have written a python script on my local laptop which uses several third party packages. I now want to run my script regularly (via a cron job) on an external server. The external server most likely does not have all the dependencies installed, is there is a way to package and deploy my python script and dependencies in order to ensure that it will run? I have already tried to package the script as an exe, but failed to do so.
./stack.sh failed while installing Openstack
28,060,641
0
1
2,026
0
python,linux,pip,openstack,devstack
Edit the script and append --allow-unverified ie pip install package_name==version --allow-unverified package_name
0
1
0
0
2015-01-21T05:01:00.000
2
0
false
28,059,948
0
0
0
2
I am not able to install OpenStack. I executed the script stack.sh and there was Error on exit. I looked at the log, the error is during the execution of the command: sudo -H -E python /home/sagar/devstack/files/get-pip.py : This is the error during the execution of the below command: sudo -H -E python /home/sagar/devstack/files/get-pip.py Collecting pip Could not find any downloads that satisfy the requirement pip No distributions at all found for pip ++ err_trap ++ local r=1
./stack.sh failed while installing Openstack
28,063,958
1
1
2,026
0
python,linux,pip,openstack,devstack
I got the problem. The system date was not correct.
0
1
0
0
2015-01-21T05:01:00.000
2
0.099668
false
28,059,948
0
0
0
2
I am not able to install OpenStack. I executed the script stack.sh and there was Error on exit. I looked at the log, the error is during the execution of the command: sudo -H -E python /home/sagar/devstack/files/get-pip.py : This is the error during the execution of the below command: sudo -H -E python /home/sagar/devstack/files/get-pip.py Collecting pip Could not find any downloads that satisfy the requirement pip No distributions at all found for pip ++ err_trap ++ local r=1
Linux PC: How to let other Linux devices copy files
28,070,608
0
0
56
0
python,linux,wifi,ftp-server
On Linux the most straightforward way would be to either use SSH (SCP), for which you only need SSH daemon enabled on the server machine, or to run a trivial webserver. No coding required in either cases.
0
1
0
0
2015-01-21T15:07:00.000
1
0
false
28,070,431
0
0
0
1
My application running under Linux creates four to seven data files in a directory whose name includes the client and datetime.These need to be copied by other devices - usually a Linux PC/laptop and potentially an Android phone. Currently the copying is done via a cable connection. I now need to make this wireless and more secure. The solution seems to be to run my PC as an FTP server and allow others to login to pull off the files. Ideally this should be coded in Python 2.7 although 'C' could be an option. The majority of the information I can find, particularly in relation to Python, refers to using the PC as a client rather than a server. Are there Python extensions for running an FTP server or is there a better way of tackling this? Thank you...
Hadoop streaming with Bash - how slow?
28,112,455
2
0
481
0
python,bash,hadoop,mapreduce,apache-spark
The main idea why Hadoop Streaming is considered to be slow is that for both mapper and reducer you have to pass arguments via stdin, which means you have to serialize them as a text, and to get the output of both mapper and reducer you have to deserialize them from the text back to Java structures, which usually consumes much time. If you have a third party compiled application that is capable of reading the input data from stdin and passing data to stdout you don't have much choice but to run it in Hadoop Streaming or in Spark pipe. But of course the native mapreduce application application would be faster as it would eliminate the need for data serialization/deserialization on passing it to the application But if your application just accepts the filename and reads the file by itself (from NFS, for instance), it would be the same speed as a native one, but of course you should consider that this type of use is not the case neither for Hadoop nor for Spark - these frameworks were developed to process the data with APIs they provide
0
1
0
0
2015-01-23T02:12:00.000
1
0.379949
false
28,101,995
0
0
0
1
I have heard from several articles that Hadoop streaming with bash is significantly slower than a compiled code or python. Is this only true for sort commands and the like? My script needs to -copy file to node -on node execute a commercial program with file as argument -pass output back to folder My intuition is telling me that this should be a similar speed to the compiled versions. Would it be?
How to run celery beat as daemon?
51,928,073
0
3
4,649
0
python,django,celerybeat
celery -A your-project beat --detach -l info -f beat.log
0
1
0
0
2015-01-23T07:56:00.000
2
0
false
28,105,364
0
0
0
1
I know there is a command for celeryd to run as daemon, i.e; celeryd_detach. But how can I run celery-beat as daemon using any command? Please help me in this. TIA
Python import packages under chroot environment
28,114,840
0
0
133
0
python
You can do all necessary imports before os.chroot.
0
1
0
0
2015-01-23T16:26:00.000
1
0
false
28,114,303
1
0
0
1
I am writing some Python script and I would like to use os.chroot to execute some code under chroot environment. The problem is after calling os.chroot, paths in sys.path lie outside of the chroot jail, so import won't work. What's the best way to do it?
How to fix "cc: error: unrecognized command line option '-Wshorten-64-to-32'" issue on Mac
28,121,167
9
4
5,118
0
python,macos
Solution is to run commands below: export CC=/usr/bin/clang export CXX=/usr/bin/clang++
0
1
0
0
2015-01-24T00:59:00.000
2
1
false
28,121,148
0
0
0
1
You may have following issue while compiling python packages on Mac: cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/misaka.c -o build/temp.macosx-10.9-intel-2.7/src/misaka.o cc: error: unrecognized command line option '-Wshorten-64-to-32' error: command 'cc' failed with exit status 1
Proper way to change bashrc when making a ubuntu package or python package
28,131,853
1
0
57
0
python,bash,package
assuming ubuntu is somewhat like debian. /etc/profile.d is probably the best way. Don't edit any files just drop a file into profile.d that checks for bash and that your package is installed and then does whatever it needs.
0
1
0
0
2015-01-24T23:55:00.000
1
1.2
true
28,131,654
1
0
0
1
I'm planning to make a program which should edit the users bashrc. In the case of python library, I'd like to add a binary to /bin/ automatically. When it is executed, then it should add a function and call it every time when a user is loggd in to bash, so I definitely should change bashrc. In the case of ubuntu package, it should do same job as desribed above. However, adding some function to bashrc seems not a proper solution because when it is removed, it should edit bashrc again but if there is any small change of added codes removal of package might make some dummy codes on bashrc. Is there any neet solution for this?
In python os library, process was blocked
28,143,351
1
1
39
0
python
The file you're deleting might be in use or requires administrative privileges to remove. You can use a subprocess to call you script as an administrator.
0
1
0
0
2015-01-26T00:44:00.000
1
0.197375
false
28,143,334
1
0
0
1
I am using os.remove in a for loop. Sometimes, the process was blocked, like a dead lock, but I'm not using a thread. I want to know why process was blocked, and what can I do to prevent it?
How to run a script that logs in to the internet at boot (before user login) on ubuntu
28,151,615
0
0
38
0
java,python,ubuntu
If you put it in ~/.bashrc it will run at the same time you log in
0
1
0
1
2015-01-26T14:01:00.000
2
0
false
28,151,557
0
0
0
1
I have made a script in Java and Python that logs in to my internet. I want to run one of it on my Ubuntu 14.10 at boot (before user login). How do I do it?
GitPython - clone_from not working
28,179,875
0
0
1,005
0
python,gitpython
You might not have git.ext in your PATH, but that can easily be tested by executing it yourself. If you see an error, you can either add it to the PATH, or set the GIT_PYTHON_GIT_EXECUTABLEto the executable git-python should execute for git commandline services.
0
1
0
0
2015-01-27T00:53:00.000
1
0
false
28,161,508
1
0
0
1
I am facing an issue while cloning a git repo. I am using function clone_from from GitPython library from git import Repo Repo.clone_from("git://github.com/facebook/buck.git", "D:\sample") I am getting error WindowsError: The system cannot find the file specified Can someone please tell me if this is how to clone a repo using the library?
How to execute a remote script using ssh
28,223,316
0
1
865
0
python,linux,bash,ssh
The solution to my problem is to use PATH=/cygdrive/c/WINDOWS/system32:/bin cmd /c in front of the script call, sth like: ssh user@host "PATH=/cygdrive/c/WINDOWS/system32:/bin cmd /c script" .This will run the script using in Windows env. In my case the problem was that the script was run under cygwin env and I wanted to be run in a Windows env.
0
1
0
1
2015-01-27T02:26:00.000
2
1.2
true
28,162,229
0
0
0
1
I know I can find multiple answers to this question but I have a problem with the result. I have a Windows PC with a script on it and a Linux PC that has to start the script using ssh. The problem I am seeing is that for some reason it's using the Linux environment to run the script and not the Windows env. Is this expected and if yes how can I start a remote script (From Linux) and still use the Windows env? Linux: Python 2.7 Windows: Python 3.4 My example: I am running:ssh user@host "WINDOWS_PYTHON_PATH Script.py arg1 arg2 arg3" and it fails internally at a copy command I can't run ssh user@host "Script.py arg1 arg2 arg3" because then it will fail to run the script because of the python version. The way I run the command in Windows is using the same syntax "Script.py arg1 arg2 arg3" and it works. It looks like it's using the Linux env to run the script. I would like to run the script on Windows no matter who triggers it. How can I achieve this?
Passing values to KSH scripts from Python
28,246,101
0
0
1,004
0
python,shell,input,ksh
You can save your parameters in Python and give them on the commandline each time you call the script. Your script can store them in a file (or database, service, ..) and read them when started again.
0
1
0
0
2015-01-27T14:22:00.000
2
0
false
28,172,741
0
0
0
1
I'm using Python to run a .ksh script, using subprocess.call(). This script requires the user to enter text at certain points - whatever the equivalent of Python's input() is in KSH I guess. The problem I'm having is that I have to run the script ~200 times, and I don't want to have to enter this information each time. Is there anyway that I can set it up so that these requests for user input are automatically given some value each time without the user even needing to do anything? I'm pretty new to using Python at the shell in this way, so apologies if this question doesn't make sense. Happy to take any feedback. I haven't found this question asked previously - mostly people ask about passing arguments to the script - but I may have missed something as I was having trouble finding the key search terms. The Python version is 2.7, and it's a UNIX environment.
Python kill scripts
28,252,408
0
0
207
0
python,windows,multithreading
My solution is place testing code in exe file. Now i can kill all python scripts, as previously. Maybe someone will offer another solution?
0
1
0
1
2015-01-27T20:59:00.000
1
0
false
28,179,883
1
0
0
1
I need to kill all python scripts except one. Unfortunattely, all scripts have similar name "pythonw.exe". Difference in PID only. First time, i don't need to leave one script alive, thats why i just kill all python scripts in system by taskkill /F /T /IM "python*" command. But now, i have one script, that automates all other scripts. The script is my simple "testing system". It rewrite object script, start, stop and restart. But my problem is multithreading in objective script (10 - 20 threads). I don't know, how to kill all python threads, except automates one. P.S. I tried to get tasklist and PID of automates script, and killed all scripts, except that one, but it doesn't work (i don't know why) P.P.S OS: Windows XP Python 2.7.8
View running application output in the browser, how?
28,188,969
1
0
1,186
0
java,c#,python,ide,desktop-application
You need a web application.Now this web application when loads send request to backend code that backend code will do SSH to remote machine and read the file from specific location.Now that read stream will be send back in response and displayed on web based UI. In these type of application few thinks matters. 1) Like if you whole file at once then it will take time to display that content to user.Better idea will be read around 100 lines at once and when user scroll down then again send request to web server to read next 100 lines in this way you can decrease response time and better user experience.
0
1
0
0
2015-01-28T09:34:00.000
2
0.099668
false
28,188,783
0
0
1
1
I have a simple cloud IDE,I want to make it able to build and run applications remotely, the target application's source files will be in a remote server in isolated virtual machine (e.g Windows 8.1,or Ubuntu 14.04). It's not difficult to build that application but how to run it and view its output to users ? What if it's a desktop application (suppose it's written in C# or Java or Python)? Note: users access there applications only using browsers (e.g Firefox,Chrome,...) Edit: desktop application may contains GUI stuff not only console ;)
Cannot find PIP in a newly-installed Python3.4 (redhat linux 4) environment
28,203,008
1
0
752
0
python-3.x,pip
In Python 3 the program will be installed as pip3. So you should be able to find it using which pip3.
0
1
0
0
2015-01-28T21:35:00.000
2
0.099668
false
28,202,854
1
0
0
1
Cannot locate PIP in a newly-installed Python3.4 (redhat linux 4) environment. $ python -V Python 3.4.1 $ which pip /usr/bin/which: no pip in (/usr/ $ python -m pip install requests /usr/local/bin/python3.4: No module named pip I installed this as an alternate installation and am able to successfully create and run python3.4 scripts. Our other implementation is python 2.3 with no pip. Any help is greatly appreciated.
where's the equivalent of connfd (created socket in C) in python's BaseHTTPRequestHandler
28,205,847
2
1
141
0
python,sockets,http,webserver
Found it! It is "self.request"!! Confusing style of naming.
0
1
1
0
2015-01-29T01:25:00.000
1
0.379949
false
28,205,527
0
0
0
1
In C socket programming at the server-side, after a connection is accepted we can get a handle of the new socket (who is transmitting the data) by "connfd" which is the return value of "accept". Now I'm trying to implement a web server with Python, I have a handler based on BaseHttpRequestHandler, who handles the requests with the do-Get method. How can I get ahold of the socket that is transmitting data now (the socket created after the accept and not the one created after bind)? The reason I need the socket is that I need to read TCP_info from getsockopt with it. Thanks!
Run replace command on svn:externals (python)
28,215,771
2
0
153
0
python,svn,externals
First of all, don't use sed. Use Python's string methods or the re module. Second, I recommend to run svn propget ... first, to fetch the old value. Then, you manipulate it (within Python, no need to run sed). Finally, you run svn propset. Alternatively, you could run a second Python script as editor for svn propedit. Here, too, you don't need sed if you already have Python.
0
1
0
0
2015-01-29T13:05:00.000
1
1.2
true
28,215,502
0
0
0
1
I am currently writing a python script which needs to run a sed command to replace stuff from the svn:externals data. I tried to run sed on "svn propedit svn:externals ." but the outcome is not the one expected. Does anyone know how to do this ?
Python in Cygwin
28,230,732
0
0
1,910
0
python,python-2.7,cygwin
No, you don't need to do so. In fact, CYGWIN will inherit the PC's PATH, plus with virtual PATH, you can input "echo $PATH" in CYGWIN and input "PATH" and the windows console, you could find that CYGWIN has more PATH setting than the windows. However, as you already overwrite the bash_profile, so it might not looks as what I said. Besides, the most significant difference is that most of the CYGWIN executable files depends on CYGWIN.dll, while the typically windows files don't.
0
1
0
0
2015-01-30T06:40:00.000
2
0
false
28,230,528
1
0
0
1
I would like to know the difference in installing Python, Paramiko packages in Cygwin and Python is already installed in my Windows PC. I have installed Cygwin too (but without Python package) and in Cygwin terminal I do the following: $echo "PATH=\$PATH:/cygdrive/c/Python27" >> .bash_profile then, source .bash_profile (after doing this I am able to run a Python script from cygwin terminal). If the steps in point number 2 works good, then still do I need to install python packages from a Cygwin mirror site ? If I have not done it, then what I might miss while running Python through Cygwin ? Thanks for your help.
Unable to locate package virtualenv in ubuntu-13 on a virtual-machine
47,263,684
6
9
24,270
0
python,ubuntu-13.10
It's also possible that you may not have run sudo apt-get update. It worked for me.
0
1
0
0
2015-01-31T21:47:00.000
7
1
false
28,256,891
1
0
0
1
When i try do the given code below: "sudo apt-get install virtualenv" the error given in response to the ubuntu-shell is: E: Unable to locate package virtualenv
Google App Engine Python Search Api's Location-based queries (Geosearch) Issues
29,008,682
0
0
248
0
python,google-app-engine,google-search-api,google-app-engine-python
There can be two reasons for this : 1 - miles instead of km 2 - conversion numbers (for example 35,322.2 is 35322.2 ? km ? miles ?) i suggest to check what exactly are the numbers processed when executing distance function, you can programmatically output this data in some logs Hope it helps
0
1
0
0
2015-02-02T06:30:00.000
1
0
false
28,272,226
0
0
1
1
I have implemented GAE's Python Search Api and am trying to query based on distance from given geopoint. My query string is: "distance(location, geopoint(XXX, YYY)) < ZZZ". However, for some reason on the production server, this query string is returning items where the distance is greater than the ZZZ parameter. Below are actual numbers (production) demonstrating the inaccuracies: Actual Distance: 343.9m Query Distance that still gets the result: 325m Actual Distance: 18,950.3 Query Distance that still gets the result: 13,499m Actual Distance: 55,979.0 Query Distance that still gets the result: 44,615m Actual Distance: 559,443.6 Query Distance that still gets the result: 451,167m Actual Distance: 53.4 Query Distance that still gets the result: 46m Actual Distance: 35,322.2 Query Distance that still gets the result: 30,808m Actual Distance: 190.2 Query Distance that still gets the result: 143m On my development server, these inaccuracies do not exist. I am able to query down to the exact meter and get the expected results. What could cause this and how to fix it so that I get accurate query results in production? Is anyone else getting the same issue?
What is the Debian equivalent of "requirements.txt" in Python for managing packages?
28,322,460
1
1
1,881
0
python,linux,debian,pip,dpkg
You can certainly dump all the packages installed by dpkg, but that's probably not what you want to do - you'll end up getting thounsands of packages unrelated to your software, and possibly breaking the system, if it's a different debian version. My advice is getting your software to a fresh debian machine and try to pip install everything from your requirements.txt. As python package installation fails (because of missing debian packages), make a text file with a newline separated list of the needed debian packages. Then, just cat my-deb-dependencies | xargs apt-get install on every new system. This takes some manual work - I don't think there's a reliable way of automating it.
0
1
0
0
2015-02-04T13:04:00.000
2
0.099668
false
28,322,139
1
0
0
1
I'm shipping a Python app for deployment on Debian servers. Providing a requirements.txt file with a list of all needed Python packages is very convenient when installing the app, especially when accompanied with a Makefile to automatically install from it using pip. But as you know some Python packages depend on Linux system packages (Debian in this case), and it would be great if I could provide a similar file with my project to install them all in one step, and define the Makefile rule to automate it. Do dpkg or apt provide such functionality?
How to prevent OSX popup for incoming connections for Python app?
54,770,045
0
9
2,455
0
macos,python-3.x
For Anaconda users who have updated to Mojave, you may be running an outdated/unsigned version of Python. Simply run conda upgrade conda to update Python to the latest version, which should also be signed, and the problem should go away. If it doesn't, then you may need to contact Anaconda's support to get them to build a signed package. Of course, you will also have to conda upgrade python for each conda environment you have.
0
1
0
0
2015-02-04T19:17:00.000
2
0
false
28,329,562
0
0
0
1
I am developing a simple python3 server app. I invoke it like this: python3 bbserver.py Each time after doing this I get the OSX popup: Do you want the application “Python.app” to accept incoming network connections? I've tried making an exception for python3 executable (there is no python3.app) in the firewall and have tried code signing with a codesign certificate thus: codesign -f -s mycodecert /Library/Frameworks/Python.framework/Versions/3.4/bin/python3 --deep No luck.
GoogleAppEngine error directory not found
28,340,241
1
0
95
0
google-app-engine,python-2.7,google-app-engine-python
Your full project path contains two space characters and needs to be quoted, also, a trailing slash might be required i.e.: C:\Python27\python.exe appcfg.py update "C:\Users\alastair\Desktop\School Files\Proxy Files\mirrorrr-master\mirrorrr-master\" assuming that's where you have your app.yaml file. In your case it's thinking you are pointing to "C:\Users\alastair\Desktop\School" file which does not exist and thus showing the error.
0
1
0
0
2015-02-05T08:57:00.000
1
0.197375
false
28,339,778
0
0
1
1
Ive been working on get a proxy working for when im school, to access sites that i use alot for work but my school dont like.. This is the error it comes up with when i try to upload the files to googles app engine.. C:\Program Files (x86)\Google\google_appengine>"C:\Python27\python.exe" appcfg.p y update C:\Users\alastair\Desktop\School Files\Proxy Files\mirrorrr-master\mirrorrr-master 09:44 PM Host: appengine.google.com Usage: appcfg.py [options] update | [file, ...] appcfg.py: error: Directory does not contain an School.yaml configuration file So im very confused on why it is asking for a "School.yaml" But i made one anyway, And even though its been made, it still displays this error, So if anyone can help, Please!
How to install python weka wrapper on ubuntu 32 bit?
35,519,213
0
0
359
0
python,weka
Before installing weka wrapper for python you are suppose to install the weka itself using sudo apt-get install weka or build from source code and add the path the enviroment variable using export wekahome="your weka path" this will make sure you have the required weka jar file in the directory
0
1
0
0
2015-02-05T09:21:00.000
3
0
false
28,340,224
0
0
0
1
The official website shows how weka-wrapper can install on ubuntu 64 bit. I want toknowhow it can be install on ubuntu 32 bit?
I used self.transport.write function to write to tcp stream, How to use flush with it?
28,348,066
1
1
74
0
python-2.7,twisted
There's no need and no way to flush either the read buffer or the write buffer.
0
1
0
0
2015-02-05T13:59:00.000
1
0.197375
false
28,345,878
0
0
0
1
I created a simple tcp connection server with Twisted framework. I use the self.transport.write function to write data to the client, but I need to flush the data. Is there a way to do this? In addition, is there a way to flush incoming data?
Why did I get a Segmentation Fault in Python when /tmp is mounted with noexec?
60,442,126
1
2
636
0
python,debugging,gdb,segmentation-fault,strace
For those who would have the same problem as I had and find this page: My CherryPy server.py ran fine on my Win10 system on python3.8 but failed with segmentation fault on my Linux system which had python3.6.1. Switching to python3.8 on Linux solved my problem.
0
1
0
0
2015-02-05T22:20:00.000
1
0.197375
false
28,355,169
0
0
0
1
I am running a custom Python 2.7.3 application on CherryPy in Linux. When I used a service script in /etc/init.d/ to start or stop the service, I encountered a Segmentation Fault (SIGSEGV). Strangely, I did not receive a SIGSEGV if I ran the start or stop command manually from the shell, using "python /path/to/file.py --stop". The service script executes the same command. After some debugging, by chance, I discovered that my /tmp was mounted with a "noexec" option. I removed the "noexec" option and the application was able to start and stop via the service scripts without any segmentation faults. When I first encountered the issue, I ran strace and generated a core dump. Nothing from either tool gave me any indication that /tmp was the culprit. My question is this: How could I have used strace or gdb to help me identify that "noexec" on /tmp was causing the segmentation faults? Here is some output from gdb when analyzing the core dump: (gdb) bt full #0 PyObject_Malloc (nbytes=4) at Objects/obmalloc.c:788 bp = 0x7f6b0fd1c6e800 \Address 0x7f6b0fd1c6e800 out of bounds\ pool = 0x7f6b0fd1c000 next = \value optimized out\ size = 0 #1 0x00007f6b0f7fd8e6 in _PyUnicode_New (length=1) at Objects/unicodeobject.c:345 new_size = 4 unicode = 0x3873480 #2 0x00007f6b0f7fdd4e in PyUnicodeUCS2_FromUnicode (u=0x38367cc, size=) at Objects/unicodeobject.c:461 unicode = \value optimized out\ (There is a lot more output, this is just the first few lines) Here is some output from strace on the failure: 3046 open("/usr/local/python2.7/lib/python2.7/site-packages/oauthlib/common.py", O_RDONLY) = 9 3046 fstat(9, {st_mode=S_IFREG|0644, st_size=13310, ...}) = 0 3046 open("/usr/local/python2.7/lib/python2.7/site-packages/oauthlib/common.pyc", O_RDONLY) = 10 3046 fstat(10, {st_mode=S_IFREG|0644, st_size=16043, ...}) = 0 3046 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fbc9ff9d000 3046 read(10, "\3\363\r\n}\321\322Tc\0\0\0\0\0\0\0\0\5\0\0\0@@\2\0sd\2\0\0d\0"..., 4096) = 4096 3046 fstat(10, {st_mode=S_IFREG|0644, st_size=16043, ...}) = 0 3046 read(10, "\0\0\0C@\2\0s\330\0\0\0t\0\0|\0\0t\1\0\203\2\0s\36\0t\0\0|\0"..., 8192) = 8192 3046 read(10, "thon2.7/site-packages/oauthlib/c"..., 4096) = 3755 3046 read(10, "", 4096) = 0 3046 close(10) = 0 3046 munmap(0x7fbc9ff9d000, 4096) = 0 3046 --- SIGSEGV (Segmentation fault) @ 0 (0) --- After fixing the problem, here's a snippet from strace, from the same point where it tries to load oauthlib/common.pyc - notice that the only difference appears to be a brk() before munmap(): 3416 open("/usr/local/python2.7/lib/python2.7/site-packages/oauthlib/common.pyc", O_RDONLY) = 10 3416 fstat(10, {st_mode=S_IFREG|0644, st_size=16043, ...}) = 0 3416 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5791f2c000 3416 read(10, "\3\363\r\n}\321\322Tc\0\0\0\0\0\0\0\0\5\0\0\0@@\2\0sd\2\0\0d\0"..., 4096) = 4096 3416 fstat(10, {st_mode=S_IFREG|0644, st_size=16043, ...}) = 0 3416 read(10, "\0\0\0C@\2\0s\330\0\0\0t\0\0|\0\0t\1\0\203\2\0s\36\0t\0\0|\0"..., 8192) = 8192 3416 read(10, "thon2.7/site-packages/oauthlib/c"..., 4096) = 3755 3416 read(10, "", 4096) = 0 3416 brk(0x372f000) = 0x372f000 3416 close(10) = 0 3416 munmap(0x7f5791f2c000, 4096) = 0 3416 close(9) = 0 What information can help me point the blame at /tmp's mount options?
How to change icon of a MAC OS folder using Python Script and Terminal commands?
39,163,917
2
3
1,414
0
macos,python-2.7,icons,xattr
Let we have a icon.icns file: Read the com.apple.ResourceFork extended attribute from the icon file Set the com.apple.FinderInfo extended attribute with folder icon flag Create a Icon file (name: Icon\r) inside the target folder Set extended attributes com.apple.FinderInfo & com.apple.ResourceFork for icon file (name: Icon\r) Hide the icon file (name: Icon\r) We can use stat and xattr modules to do this.
0
1
0
0
2015-02-06T14:58:00.000
1
0.379949
false
28,368,533
0
0
0
1
I am trying to write the Code in Python to Change the Icon of a Mac OS X folder using just the Python Script (Without XCODE or any other API). The procedure is that I have a icon.icns file , I need to change the folder icon to the icon.icns file using the python script.
How to use remote python modules
29,157,556
1
0
32
0
python-3.x,python-import,python-module
You would be better off to install those modules locally. Can you create packages of those modules (either using pip or something similar) then you can distribute them to your local box. Of what I know, there is nothing similar.
0
1
1
1
2015-02-07T06:30:00.000
1
1.2
true
28,379,325
0
0
0
1
How I can use some 'extra' python module which is not located localy but on a remote server? Somthing like using maven dependencies with Java
python - How to share files between many computers
28,388,912
1
2
516
0
python
Okay, first point is that you can't share memory among machines unless you're on a very specialized architecture. (Massively parallel machines, Beowulf clusters, and so on.) If you mean to share code, then package your code into a real Python package and distribute it with a tool like Chef, Puppet or Docker. If you mean to share data, use a database of some sort that all your workers can access. I'm fond of MongoDB because it's easy to match to an application, but there are a million others databases. A lot of people use mysql or postgresql.
0
1
0
0
2015-02-07T23:46:00.000
1
0.197375
false
28,388,896
1
0
0
1
My python process run on different machines. It consists of a manager and many workers. The worker in each machine are multi threaded and needs to update some data such as its status to the manager residing on another machine. I didn't want to use mysql because many other processes are already executing many queries on it and it will reach its max_connection I have two methods in mind: For each worker thread, write the data to a local text file. A separate bash script will run a while-loop, check for file change and scp this file to all other machines. For each worker thread, write the data to share memory and have it replicated to all other machines. I am not sure how to do this. In python how can i write to shared memory? How can i replicated shared memories?
Webpage ping when active
28,397,610
1
0
47
0
python,google-app-engine,web
The best way is to ping the server while the user is online. Using other methods such as the Channel API with GAE proves to be unreliable since you are not constantly sending a ping message but rather just sending a disconnect message. If the browser crashes, no disconnect message is sent.
0
1
0
0
2015-02-08T03:29:00.000
1
1.2
true
28,390,253
0
0
1
1
I want a way for users to open this webpage, and whenever they are on that page, it updates the server that they are on the page. It should only work when the user is actually looking at the webpage (not inactive, like from switchings tabs). One way to do this which I have implemented is to keep pinging the server saying that I am alive. This however causes a lot of load on the server and client side. I am using Google App Engine and webapp2, and was wondering if anyone knows a better way to do this.
Fail to install Python 2.7.9 on a Windows google compute engine instance
30,692,067
7
7
7,533
0
python-2.7,windows-server-2008,google-compute-engine
Install python EXCEPT "pip" Run the python install msi again and select "change" Select "pip" and install the pip It would be works... I think it is a priority problem into the msi package...the package seems to try to install the pip before installing python.exe. So, pip can not be installed...
0
1
0
0
2015-02-09T07:35:00.000
4
1
false
28,404,878
1
0
0
2
I fired up a new Windows google compute engine instance. It's running Windows 2008 R2, service pack 1. I download and try running the Python .msi installer for version 2.7.9, and it fails with this error: There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. I see this error for both the 64-bit and the 32-bit installer. Has anyone else seen it or know of a work-around?
Fail to install Python 2.7.9 on a Windows google compute engine instance
31,103,137
0
7
7,533
0
python-2.7,windows-server-2008,google-compute-engine
It seems to be a dependency issue, please try to install "Microsoft Visual C++ 2008 SP1 Redistributable Package (x64)"
0
1
0
0
2015-02-09T07:35:00.000
4
0
false
28,404,878
1
0
0
2
I fired up a new Windows google compute engine instance. It's running Windows 2008 R2, service pack 1. I download and try running the Python .msi installer for version 2.7.9, and it fails with this error: There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. I see this error for both the 64-bit and the 32-bit installer. Has anyone else seen it or know of a work-around?
Python subprocess.check_call terminate and start from where it terminated
28,411,277
0
0
58
0
python,subprocess,terminate
So, this is not a question involving code, so you get a general answer, not involving code. The solution to your problem requires you to keep protocol. This protocol must survive the lifetime of your test processes. So, there must be some place where you can write to about the state of your tests, and this place must ensure persistence. What might that be? Right, the file system, for instance. The most simple place to keep track of your tests is the file system. What follows is one very simple example of how you might want to implement this: For each test case that succeeded, write a file to the current working directory, indicating success for this test. Then, before your test process would invoke a certain test, make it check the existence of such file and make it skip the test if the file is found. Let's assume your input files have different basenames (e.g. A, B, ...,). You can then use a file called B.success in the current working directory to indicate that this does not need to be tested anymore.
0
1
0
0
2015-02-09T13:38:00.000
2
0
false
28,411,082
0
0
0
1
I am trying to automatize some test cases using subprocess_check.call() by calling another python script with an input and output files. I have approx. 10 input files. When I started to test, for example, first and second files were tested successfully but in the third file I got an error and the script was terminated. What I want is, how can I run my script from where it was terminated ? I do not want to start from the beginning. I just wanted to continue my test from the case where I got an error. After correcting the input file, starting from this file I want to run the script until the end. Any ideas?
Packaging python scripts to .exe on Ubuntu
28,415,565
1
0
45
0
python,windows,ubuntu,exe
cx_freeze is another option for freezing cross-platform.
0
1
0
0
2015-02-09T17:17:00.000
1
1.2
true
28,415,460
1
0
0
1
I have been trying to package my python scripts into .exe setup for Windows. Is that any way I can do the same while running Ubuntu?
Setting path for Python in PowerShell?
28,416,220
3
5
15,527
0
python,powershell,path
Python 2.6.1 is already in your path as demonstrated by item number 2 in your list. On number 3, you're adding Python 2.7 to your path after Python 2.6.1's entry. You need to remove Python 2.6.1 from your environment variable, or at a minimum, set it so that 2.7 is listed first.
0
1
0
0
2015-02-09T17:55:00.000
2
0.291313
false
28,416,182
1
0
0
1
I have two Python versions on my machine (Windows Vista), 2.6 (located in C/Program files) and 2.7 (located in C/). 1- I open PowerShell 2- I type python, and it calls python 2.6.1. 3- I want to change the path for Python 2.7, so I type: [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User") 4- and then when I run python again it still calls the version 2.6. and there is no way I can change it. I also tried to restart the computer after changing the path, with no success. Any suggestions?
Mac OSX Trouble Running pip commands
35,575,253
0
0
797
0
python,django,macos,pip
Try adding sudo. sudo pip install Django
0
1
0
0
2015-02-10T01:19:00.000
2
0
false
28,422,520
0
0
1
2
I recently installed Python 3.4 on my Mac and now want to install Django using pip. I tried running pip install Django==1.7.4 from the command line and received the following error: Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/basecommand.py", line 232, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/commands/install.py", line 347, in run root=options.root_path, File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_set.py", line 549, in install **kwargs File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_install.py", line 754, in install self.move_wheel_files(self.source_dir, root=root) File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_install.py", line 963, in move_wheel_files isolated=self.isolated, File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/wheel.py", line 234, in move_wheel_files clobber(source, lib_dir, True) File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/wheel.py", line 205, in clobber os.makedirs(destdir) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/django' Obviously my path is pointing to the old version of Python that came preinstalled on my computer, but I don't know how to run the pip on the new version of Python. I am also worried that if I change my file path, it will mess up other programs on my computer. Is there a way to point to version 3.4 without changing the file path? If not how do I update my file path to 3.4?
Mac OSX Trouble Running pip commands
70,606,374
0
0
797
0
python,django,macos,pip
Try to create a virtual environment. This can be achieved by using python modules like venv or virtualenv. There you can change your python path without affecting any other programs on your machine. If then the error is is still that you do not have permission to read files, try sudo pip install. But only as a last resort since pip recommends not using it as root.
0
1
0
0
2015-02-10T01:19:00.000
2
0
false
28,422,520
0
0
1
2
I recently installed Python 3.4 on my Mac and now want to install Django using pip. I tried running pip install Django==1.7.4 from the command line and received the following error: Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/basecommand.py", line 232, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/commands/install.py", line 347, in run root=options.root_path, File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_set.py", line 549, in install **kwargs File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_install.py", line 754, in install self.move_wheel_files(self.source_dir, root=root) File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_install.py", line 963, in move_wheel_files isolated=self.isolated, File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/wheel.py", line 234, in move_wheel_files clobber(source, lib_dir, True) File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/wheel.py", line 205, in clobber os.makedirs(destdir) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/django' Obviously my path is pointing to the old version of Python that came preinstalled on my computer, but I don't know how to run the pip on the new version of Python. I am also worried that if I change my file path, it will mess up other programs on my computer. Is there a way to point to version 3.4 without changing the file path? If not how do I update my file path to 3.4?
How to get network path from local path?
28,432,344
0
1
1,113
0
python,python-2.7
Having thought about the problem itself: No, it's not possible to do this in any general way, because there's absolutely no reason why C:\path\to\file should correspond to \\PCNAME\C:\path\to\file; that requires that the folder C:\ has the share name C:, which might be canonical on windows machines, but not fixed. In fact, normal users don't even get to read the full list of shares of a windows computer including their local bindings. EDIT: as the others pointed out, there are ways to get your machines network name, but you'll have to build the network path with that manually, and I think your question was about automatically matching a file to it's windows share "URL".
0
1
1
0
2015-02-10T12:55:00.000
3
0
false
28,432,231
0
0
0
1
I have a local path like C:\Users\some_user\Desktop\some_folder\attachments\20150210115. I need to generate network path with python like \\PC_NAME\C:\Users\some_user\Desktop\some_folder\attachments\20150210115 or something like this to get this folder from other windows pc. Is it possible to do in python automatically or I need just to hardcode local path replacing pc name and other staff? UPDATE Sorry, I not so familiar with Windows path as I live in Linux. I just need to generate network path for local path and send it to other device.
How do i stop process running a certain Python script?
31,284,981
0
0
194
0
python,linux,ps
Easiest way to keep it simple would be to create a screen for each. screen -S prod and screen -S test, then run the python script in the background of each and detach the screen (using ctrl +a+d) then when you need to stop one screen -r prod then kill it/restart then detach again.
0
1
0
1
2015-02-10T17:18:00.000
2
0
false
28,437,813
0
0
0
2
I am running two different Python scripts on a Ubuntu VPS. One of them is the production version, and the other one is for testing purposes. From time to time, I need to kill or restart one of them. However ps does not show which script does each Python process runs. What is the conventional way to do this?
How do i stop process running a certain Python script?
28,437,903
2
0
194
0
python,linux,ps
ps -AF will give you All processes (not only the ones in your current terminal, or run as your current user), in Full detail, including arguments.
0
1
0
1
2015-02-10T17:18:00.000
2
0.197375
false
28,437,813
0
0
0
2
I am running two different Python scripts on a Ubuntu VPS. One of them is the production version, and the other one is for testing purposes. From time to time, I need to kill or restart one of them. However ps does not show which script does each Python process runs. What is the conventional way to do this?
Error while installing Icehouse openstack using devstack
28,613,401
1
0
636
0
python,python-2.7,ubuntu-12.04,openstack,devstack
artemdevel is right! Run the following and you should be good to go : sudo rm /usr/lib/python2.7/dist-packages/setuptools.egg-info sudo apt-get install --reinstall python-setuptools
0
1
0
0
2015-02-10T21:00:00.000
1
0.197375
false
28,441,674
0
0
0
1
I am trying to install the icehouse openstack on Ubuntu 12.04 amd64, which is in VirtualBox. I am using devstack to do so. So, I am executing the script "stack.sh". While executing it throws this error: IOError:[Error 2]No such file or directory: '/usr/lib/python2.7/dist-packages/setuptools.egg-info' I even updated and upgraded the Ubuntu (by running the command sudo apt-get update/upgrade),before downloading the devstack and it took a long time, but even after that, the error still comes.
Passing shell command to a terminal application from an App in Mac
28,468,268
1
0
814
0
python,macos,argument-passing,exit-code,py2app
Quoting from Py2app 0.6.4 minor feature release: Issue #15: py2app now has an option to emulate the shell environment you get by opening a window in the Terminal. Usage: python setup.py py2app --emulate-shell-environment This option is experimental, it is far from certain that the implementation works on all systems. Using this option with Py2app solved the problem of blocked communication between Py2app-frozen app and Os X shell.
0
1
0
0
2015-02-10T23:57:00.000
2
1.2
true
28,444,173
0
0
0
2
I have frozen a python based GUI script using Py2app successfully but I run into trouble using this app on Mac. This app is supposed to send arguments/parameters to Clustal, a terminal-based application, but it instead returns an error non-zero exit status 127, '/bin/sh: clustal: command not found'. I found that my frozen app can send shell command successfully when I execute the same app from Frozen_apl.app>Contents>MacOS>Frozen_apl (which is a UNIX executable file). Why do these shell commands get blocked when they are passed directly from app? How can I get around this problem? Note: Clustal is properly installed and its path is properly set. I use OS X 10.9. I have same script frozen for Ubuntu and Windows and they work just fine.
Passing shell command to a terminal application from an App in Mac
28,464,729
1
0
814
0
python,macos,argument-passing,exit-code,py2app
[Based on the discussion in comments] This isn't a problem with the arguments, it's due to the spawned shell not being able to find the clustal executable. I'm not sure why this is, since it's in /usr/local/bin/clustal, and since /usr/local/bin is in OS X's default PATH (it's listed in /etc/paths). Using the full path to the executable worked, so it appears the frozen app is spawning a shell with a non-default PATH. Including the full path (/usr/local/bin/clustal) in the frozen app isn't really an optimal solution; it'd be better to figure out how to get a normal PATH in the spawned shell. But I'm now familiar enough with Py2app to know how to do this. (JeeYem: please give the workaround you came up with in a comment or another answer.)
0
1
0
0
2015-02-10T23:57:00.000
2
0.099668
false
28,444,173
0
0
0
2
I have frozen a python based GUI script using Py2app successfully but I run into trouble using this app on Mac. This app is supposed to send arguments/parameters to Clustal, a terminal-based application, but it instead returns an error non-zero exit status 127, '/bin/sh: clustal: command not found'. I found that my frozen app can send shell command successfully when I execute the same app from Frozen_apl.app>Contents>MacOS>Frozen_apl (which is a UNIX executable file). Why do these shell commands get blocked when they are passed directly from app? How can I get around this problem? Note: Clustal is properly installed and its path is properly set. I use OS X 10.9. I have same script frozen for Ubuntu and Windows and they work just fine.
Python - Check if linux partition is read-only or read-write?
28,456,469
6
0
2,297
0
python,linux
EDIT: The answer makes the assumption that you plan to write to /mnt. I would just try to write to it and catch OSError exception to handle the read-only case.
0
1
0
1
2015-02-11T14:04:00.000
3
1
false
28,456,349
0
0
0
1
I have a python application running on a beaglebone. How do I (in Python) check if the "/mnt" partition is mounted as read-only or read-write?
Is CapeDwarf compatible with Python GAE?
28,474,564
1
1
105
0
python,google-app-engine,capedwarf
Yes, as Alex posted - CapeDwarf is Java only.
0
1
0
0
2015-02-12T01:08:00.000
2
0.099668
false
28,467,558
0
0
1
1
I'm trying to deploy my GAE application - written with Python - on CapeDwarf (WildFly_2.0.0.CR5). But all the documentation talking only about Java Application. So is CapeDwarf can deploy Python Application ? if it is, how to do it ? else any other application that can ?
why cmd can not run "python a.py",but "python E:\python\python2.79\a.py"is ok..."python a.py"is taught by a python book
28,492,782
1
0
41
0
python
It seems like you are not in the same directory as a.py. If so, you will need the absolute path rather than the relative path. That is probably why python (location of a.py) runs but python a.py will not. Make sure that you are running a.py from the same directory as you saved it in.
0
1
0
0
2015-02-13T04:53:00.000
2
1.2
true
28,492,747
1
0
0
2
Just like I ask in the title I try to run "python a.py" in cmd but it says no such file or directory "python E:\python\python2.79\a.py" can run.. ..I am a newbie in python...I will appeciate for your answers
why cmd can not run "python a.py",but "python E:\python\python2.79\a.py"is ok..."python a.py"is taught by a python book
28,492,784
0
0
41
0
python
Usually, when you're using a shell, you're positioned in a directory in the filesystem. The first example, python a.py uses a relative path; it says "the file I want to run is a.py in the very same directory I'm currently in". The second example, python E:\python\python2.79\a.py uses an absolute path; it says "no matter where I'm in the filesystem, the complete path to the file I want to run is this one". Then, simply, if you're not in the directory where a.py is, and you run python a.py, python will say it couldn't find that file.
0
1
0
0
2015-02-13T04:53:00.000
2
0
false
28,492,747
1
0
0
2
Just like I ask in the title I try to run "python a.py" in cmd but it says no such file or directory "python E:\python\python2.79\a.py" can run.. ..I am a newbie in python...I will appeciate for your answers
Python - techniques for reverting changes to a folder?
28,500,816
0
0
96
0
python,package-managers,revert
You could have two solutions First is to 1. copy the files into a temp folder and on success 2. remove the old folder 3. move the temp folder into the new one if Second is to 1.copy the files into a directory, versioned by name, something like C:\Programs\v2, v3, v4 etc. 2. If everything is ok, you create a junction point or a symlink to the destination you want.
0
1
0
0
2015-02-13T12:31:00.000
2
0
false
28,499,705
1
0
0
1
I am writing a package manager in python for users to install programs we write at work. When 'installing' a new tool (which is just a process of copying files/folders from locations on a server to the users' computer), it may fail before completion for whatever reason. If this happens, I need a way to 'undo' all the changes made on the users' PC (I remove anything that was copied across). What techniques are there to implement this sort of 'revert' functionality? (Windows only solution)
Getting output files from external program using python
28,502,174
0
0
100
0
python,output
I can not comment on your question because my reputation is too low. If you use os.system or subprocess.check_output or os.popen, you will just get the standard output of your xyz program (if it is printing something in the screen). To see the files in some directory, you can use os.listdir(). Then you can use these files in your script afterwards. It may also be worth using subprocess.check_call. There may be other better and more efficient solutions.
0
1
0
0
2015-02-13T13:49:00.000
3
0
false
28,501,107
0
0
0
2
I am using Python 2.7.3 in Ubuntu 12.04 OS. I have an external program say 'xyz' whose input is a single file and two files say 'abc.dat' and 'gef.dat' are its output. When I used os.system or subprocess.check_output or os.popen none of them printed the output files in the working directory. I need these output files for further calculations. Plus I've to keep calling the 'xyz' program 'n' times and have to keep getting the output 'abc.dat' and 'gef.dat' every time from it. Please help. Thank you
Getting output files from external program using python
28,558,974
0
0
100
0
python,output
Thank you for answering my question but the answer to my question is this - import subprocess subprocess.call("/path/to/software/xyz abc.dat", shell=True) which gave me the desired the output. I tried the subprocess-related commands but they returned error " No such file or directory". The 'shell=True' worked like a charm. Thank you all again for taking your time to answer my question.
0
1
0
0
2015-02-13T13:49:00.000
3
0
false
28,501,107
0
0
0
2
I am using Python 2.7.3 in Ubuntu 12.04 OS. I have an external program say 'xyz' whose input is a single file and two files say 'abc.dat' and 'gef.dat' are its output. When I used os.system or subprocess.check_output or os.popen none of them printed the output files in the working directory. I need these output files for further calculations. Plus I've to keep calling the 'xyz' program 'n' times and have to keep getting the output 'abc.dat' and 'gef.dat' every time from it. Please help. Thank you
checking whether the C compiler works... no when installing python 2.6 (mac os x lion)
28,530,379
2
4
6,376
0
c,xcode4,osx-lion,python-2.6
Actually I found the problem. The problem was with the ld: library not found for -lgcc_ext.10.5 The gcc version given by Xcode 4.6.3 on Mac OS X Lion is 4.6. I installed the new gcc via homebrew, brew install gcc. I symlink my gcc to gcc-4.9 by doing ln -s /usr/local/bin/gcc /usr/local/bin/gcc-4.9. make sure the that in your PATH /usr/local/bin is before /usr/bin ). To a ls -l 'which gcc' to check that gcc is associated to the 4.9 version. Once this is done, the library is found and python 2.6 can be installed using pyenv.
0
1
0
1
2015-02-13T18:25:00.000
1
1.2
true
28,506,217
0
0
0
1
I'm trying to install python 2.6 using pyenv but when doing pyenv install 2.6.9I get the following: checking MACHDEP... darwin checking EXTRAPLATDIR... $(PLATMACDIRS) checking machine type as reported by uname -m... x86_64 checking for --without-gcc... no checking for gcc... gcc checking whether the C compiler works... no configure: error: in `/var/folders/r9/771hsm9931sd81ppz31384p80000gn/T/python-build.20150213191018.2121/Python-2.6.9': configure: error: C compiler cannot create executables I've installed Xcode 4.6.3 and installed Command Line Tools as info. Cheers, Ch
Google NDB: Adding an entity with non existing parent
28,513,820
4
1
168
0
python,google-app-engine,google-cloud-datastore
You can create a key for any entity whether this entity exists or not. This is because a key is simply an encoding of an entity kind and either an id or name (and ancestor keys, if any). This means that you can store a child entity before a parent entity is saved, as long as you know the parent's id or name. You cannot reassign a child from one parent to another, though.
0
1
0
0
2015-02-14T08:18:00.000
2
0.379949
false
28,513,774
0
0
1
1
I am working on a web application based on Google App Engine (Python / Webapp2) and Google NDB Datastore. I assumed that if I tried to add a new entity using as parent key the key of a no longer existing entity an exception was thrown. I have instead found the entity is actually created. Am i doing something wrong? I may check before whether the parent still exist through a keys_only query. Does it consume GAE read quotas?
Problems using psycopg2 on Mac OS (Yosemite)
60,101,069
13
48
17,998
1
python,eclipse,macos,postgresql,psycopg2
I was able to fix this on my Mac (running Catalina, 10.15.3) by using psycopg2-binary rather than psycopg2. pip3 uninstall psycopg2 pip3 install psycopg2-binary
0
1
0
0
2015-02-14T13:12:00.000
8
1
false
28,515,972
0
0
0
2
Currently I am installing psycopg2 for work within eclipse with python. I am finding a lot of problems: The first problem sudo pip3.4 install psycopg2 is not working and it is showing the following message Error: pg_config executable not found. FIXED WITH:export PATH=/Library/PostgreSQL/9.4/bin/:"$PATH” When I import psycopg2 in my project i obtein: ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so Library libssl.1.0.0.dylib Library libcrypto.1.0.0.dylib FIXED WITH: sudo ln -s /Library/PostgreSQL/9.4/lib/libssl.1.0.0.dylib /usr/lib sudo ln -s /Library/PostgreSQL/9.4/lib/libcrypto.1.0.0.dylib /usr/lib Now I am obtaining: ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _lo_lseek64 Referenced from: /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so Expected in: /usr/lib/libpq.5.dylib in /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so Can you help me?
Problems using psycopg2 on Mac OS (Yosemite)
28,949,608
4
48
17,998
1
python,eclipse,macos,postgresql,psycopg2
I am using yosemite, postgres.app & django. this got psycopg2 to load properly for me but the one difference was that my libpq.5.dylib file is in /Applications/Postgres.app/Contents/Versions/9.4/lib. thus my second line was sudo ln -s /Applications/Postgres.app/Contents/Versions/9.4/lib/libpq.5.dylib /usr/lib
0
1
0
0
2015-02-14T13:12:00.000
8
0.099668
false
28,515,972
0
0
0
2
Currently I am installing psycopg2 for work within eclipse with python. I am finding a lot of problems: The first problem sudo pip3.4 install psycopg2 is not working and it is showing the following message Error: pg_config executable not found. FIXED WITH:export PATH=/Library/PostgreSQL/9.4/bin/:"$PATH” When I import psycopg2 in my project i obtein: ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so Library libssl.1.0.0.dylib Library libcrypto.1.0.0.dylib FIXED WITH: sudo ln -s /Library/PostgreSQL/9.4/lib/libssl.1.0.0.dylib /usr/lib sudo ln -s /Library/PostgreSQL/9.4/lib/libcrypto.1.0.0.dylib /usr/lib Now I am obtaining: ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _lo_lseek64 Referenced from: /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so Expected in: /usr/lib/libpq.5.dylib in /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so Can you help me?
How to call command line command (AFNI command)?
28,565,218
0
0
411
0
python,subprocess,dicom,pydicom
Oh this was due to syntax error using Pydicom. I wanted to access 0019, 109c tag. Syntax should be: ds[0x0019,0x109c].value. not ds[aaaa,bbbb].value
0
1
0
0
2015-02-16T02:00:00.000
2
0
false
28,533,515
0
0
0
1
I am trying to read a dicom header tag in dicom file. Now, there are two ways to read this dicom header tag. 1) Using pydicom package in python which apparently is not working well on my python installed version(python 3). 2) or when i call AFNI function 'dicom_hinfo' through command line, i can get dicom tag value. The syntax to call afni function in terminal is as follows: dicom_hinfo -tag aaaa,bbbb filename.dcm output:fgre Now how should i call this dicom-info -tag aaaa,bbbb filename.dcm in python script. I guess subprocess might work but not sure about how to use it in this case.
Hanging script and cmd won't close
29,957,535
-1
0
749
0
python,python-2.7,windows-7,cmd
The filepaths I was pulling files from were through ClearCase directories. It turned out that I simply had to reinstall ClearCase. There must have been some configuration issue that was causing the cmd to hang and thus forcing a hard reboot. It's good to point out that I am no longer experiencing this problem and that nothing was wrong with the python scripts.
0
1
0
0
2015-02-17T21:57:00.000
1
1.2
true
28,571,885
0
0
0
1
I am trying to run a python script via cmd prompt on my work PC (Windows 7, Python 2.7). The script requires filepaths from different drives on my PC. I am correctly pulling all necessary filepaths and I press Enter to run the script but the script just hangs. The only thing that shows is a blinking underscore. I try to click the X to close the prompt but nothing happens. I am not able to Ctrl+C out of the program either. I open up Task Manager and I am not able to End Task (nothing happens) or End Process (cmd.exe doesn't even show up in this tab). I also tried Start-->Run-->taskkill /im cmd.exe but nothing happens. The rest of my team has no problem with Python 2.7. The only way to get out of the frozen cmd is to hold down the power button. I do not want to have to keep going through this process especially since this is during work. I'm hoping someone will be able to help me out: Any idea what's wrong with the version of Python I am using? How am I able to kill cmd.exe so that I can continue normal work functions without having to hold down the power button and waiting 5-10 minutes to reboot my PC?
Why use Python's os module methods instead of executing shell commands directly?
28,583,621
327
158
27,738
0
python,linux,operating-system
It's faster, os.system and subprocess.call create new processes which is unnecessary for something this simple. In fact, os.system and subprocess.call with the shell argument usually create at least two new processes: the first one being the shell, and the second one being the command that you're running (if it's not a shell built-in like test). Some commands are useless in a separate process. For example, if you run os.spawn("cd dir/"), it will change the current working directory of the child process, but not of the Python process. You need to use os.chdir for that. You don't have to worry about special characters interpreted by the shell. os.chmod(path, mode) will work no matter what the filename is, whereas os.spawn("chmod 777 " + path) will fail horribly if the filename is something like ; rm -rf ~. (Note that you can work around this if you use subprocess.call without the shell argument.) You don't have to worry about filenames that begin with a dash. os.chmod("--quiet", mode) will change the permissions of the file named --quiet, but os.spawn("chmod 777 --quiet") will fail, as --quiet is interpreted as an argument. This is true even for subprocess.call(["chmod", "777", "--quiet"]). You have fewer cross-platform and cross-shell concerns, as Python's standard library is supposed to deal with that for you. Does your system have chmod command? Is it installed? Does it support the parameters that you expect it to support? The os module will try to be as cross-platform as possible and documents when that it's not possible. If the command you're running has output that you care about, you need to parse it, which is trickier than it sounds, as you may forget about corner-cases (filenames with spaces, tabs and newlines in them), even when you don't care about portability.
0
1
0
0
2015-02-17T23:00:00.000
6
1.2
true
28,572,833
0
0
0
3
I am trying to understand what is the motivation behind using Python's library functions for executing OS-specific tasks such as creating files/directories, changing file attributes, etc. instead of just executing those commands via os.system() or subprocess.call()? For example, why would I want to use os.chmod instead of doing os.system("chmod...")? I understand that it is more "pythonic" to use Python's available library methods as much as possible instead of just executing shell commands directly. But, is there any other motivation behind doing this from a functionality point of view? I am only talking about executing simple one-line shell commands here. When we need more control over the execution of the task, I understand that using subprocess module makes more sense, for example.
Why use Python's os module methods instead of executing shell commands directly?
28,582,402
11
158
27,738
0
python,linux,operating-system
It's far more efficient. The "shell" is just another OS binary which contains a lot of system calls. Why incur the overhead of creating the whole shell process just for that single system call? The situation is even worse when you use os.system for something that's not a shell built-in. You start a shell process which in turn starts an executable which then (two processes away) makes the system call. At least subprocess would have removed the need for a shell intermediary process. It's not specific to Python, this. systemd is such an improvement to Linux startup times for the same reason: it makes the necessary system calls itself instead of spawning a thousand shells.
0
1
0
0
2015-02-17T23:00:00.000
6
1
false
28,572,833
0
0
0
3
I am trying to understand what is the motivation behind using Python's library functions for executing OS-specific tasks such as creating files/directories, changing file attributes, etc. instead of just executing those commands via os.system() or subprocess.call()? For example, why would I want to use os.chmod instead of doing os.system("chmod...")? I understand that it is more "pythonic" to use Python's available library methods as much as possible instead of just executing shell commands directly. But, is there any other motivation behind doing this from a functionality point of view? I am only talking about executing simple one-line shell commands here. When we need more control over the execution of the task, I understand that using subprocess module makes more sense, for example.
Why use Python's os module methods instead of executing shell commands directly?
28,573,425
16
158
27,738
0
python,linux,operating-system
Shell call are OS specific whereas Python os module functions are not, in most of the case. And it avoid spawning a subprocess.
0
1
0
0
2015-02-17T23:00:00.000
6
1
false
28,572,833
0
0
0
3
I am trying to understand what is the motivation behind using Python's library functions for executing OS-specific tasks such as creating files/directories, changing file attributes, etc. instead of just executing those commands via os.system() or subprocess.call()? For example, why would I want to use os.chmod instead of doing os.system("chmod...")? I understand that it is more "pythonic" to use Python's available library methods as much as possible instead of just executing shell commands directly. But, is there any other motivation behind doing this from a functionality point of view? I am only talking about executing simple one-line shell commands here. When we need more control over the execution of the task, I understand that using subprocess module makes more sense, for example.