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
Run Python script when I log into my system? [xubuntu 15.04]
30,175,033
0
1
517
0
python,linux,python-3.x,xubuntu
Found the answer. You have to go Configuration/Systemsettings/Session and Startup, and add the program.
0
1
0
1
2015-05-11T18:03:00.000
1
1.2
true
30,174,585
0
0
0
1
How can i run a python script at startup with xubuntu 15.04? I want to run a script that reminds me of things,like backup,buying thing,calling somebody. I already have the script,i just need it to start at startup. (Python 3.4) As far i know, xubuntu 15.04 uses systemd. All the tutorials i found,are for init.d or upstart. I need one for systemd
Unabe to Get OpenStack Login prompt
30,254,113
0
0
808
0
python,openstack,openstack-horizon
if you are running on Horizon on Apache then you need to check apache logs to identify issue. Horizon logs will not contains anything if apache was not able to execute WSGI script for Horizon.
0
1
1
0
2015-05-11T18:21:00.000
2
0
false
30,174,910
0
0
0
2
I have OpenStack UI running. I made some changes in the local-setting.py file and restarted the Horizon service using service httpd restart and try to hit OpenStack UI but it returns an error: "HTTP 400 Bad request". When I revert back all changes, restart the service and try again the error is still there. Please help me !!
Unabe to Get OpenStack Login prompt
52,743,233
1
0
808
0
python,openstack,openstack-horizon
Total agree with above comments, check your apache or httpd log files. Most probably error cause due to improper info. added (for centos) under below file. /etc/openstack-dashboard/local_settings ALLOWED_HOSTS = ['XX.XX.XX.XX', 'ControllerName', 'localhost'] Hopefully this will resolve issue.
0
1
1
0
2015-05-11T18:21:00.000
2
0.099668
false
30,174,910
0
0
0
2
I have OpenStack UI running. I made some changes in the local-setting.py file and restarted the Horizon service using service httpd restart and try to hit OpenStack UI but it returns an error: "HTTP 400 Bad request". When I revert back all changes, restart the service and try again the error is still there. Please help me !!
subprocess window disappear quickly
30,195,117
0
1
425
0
python,windows
In windows, the common way of keeping cmd windows opened after the end of a console process is to use cmd /k Example : in a cmd window, typing start cmd /k echo foo opens a new window (per start) displays the output foo leave the command window opened
0
1
0
0
2015-05-12T14:49:00.000
2
0
false
30,194,383
0
0
0
1
In python, I use subprocess.Popen() to launch several processes, I want to debug those processes, but the windows of those processes disappeared quickly and I got no chance to see the error message. I would like to know whether there is any way I can stop the window from disappearing or write the contents in the windows to a file so that I can see the error message later. Thanks in advance!
How do I run the python files from command shell/command prompt?
30,197,578
6
1
1,174
0
python,shell
import name is a python keyword for use within a python script and/or the python interactive interpreter (repl). python filename.py is a shell command for use at a command prompt or within a shell script to run the python interpreter on a given python script file. The working directory does not matter other than for whether the file listed in python filename.py can be found. So for python filename.py to work you must be in the same directory as filename.py but you could just as readily use python c:\users\user\some\other\path\filename.py in which case the current directory isn't used to find the file. If you get python syntax errors from attempting to run python on a python file that's a python error in the code and you will need to look at the python file to see what the error is.
0
1
0
0
2015-05-12T17:18:00.000
2
1.2
true
30,197,523
1
0
0
2
Really frustrated with this as one thing works at one time. Sometimes import filename.py works. But in the tutorials all I see is python filename.py. But when I try to give that, I am facing an error like invalid syntax. I have edited all the environment variables and I have C:\Python27 folder in the same location. To be able to run the files using python filename.py what are the conditions that must be met? What should be the current working directory? Should the .py files be there in the same working directory?
How do I run the python files from command shell/command prompt?
30,197,771
0
1
1,174
0
python,shell
Just to be clear, typing python filename.py only works from the Terminal (i.e. cmd.exe, Windows PowerShell, the "Terminal" application on a Linux kernel, etc.), not from the Python interpreter (i.e. python.exe), and only works if you have used the cd command to change into the directory in which the file is saved (so that the terminal knows where to look for filename.py). import filename can be used from the Python interpreter, but is not the ideal method as it creates a compiled version of filename.py and can only be used once (you would have to restart the interpreter to do so again). I'm not sure whether this works in the official Python distribution available from the Python website, but at least in the Anaconda distribution, you can run a file from the Python interpreter using runfile("C:/Users/CurrentUser/Subfolder/filename.py").
0
1
0
0
2015-05-12T17:18:00.000
2
0
false
30,197,523
1
0
0
2
Really frustrated with this as one thing works at one time. Sometimes import filename.py works. But in the tutorials all I see is python filename.py. But when I try to give that, I am facing an error like invalid syntax. I have edited all the environment variables and I have C:\Python27 folder in the same location. To be able to run the files using python filename.py what are the conditions that must be met? What should be the current working directory? Should the .py files be there in the same working directory?
how to upload the existing app in to web2py environment
30,356,551
0
2
724
0
python,web2py
Just use the file system. GUI: Copy your application folder to your new instance of web2py (/web2py/applications). Command line: scp -r /home/username/oldarea/web2py/application/myApp /home/username/newarea/web2py/applications
0
1
0
0
2015-05-13T07:31:00.000
1
0
false
30,208,421
0
0
1
1
I am new to web2py I have web2py application in my local system i want to upload this application into web2py environment throught admin interface option present in web2py Upload & install packed application and do some modifications and run the application but i am unable to uploded the app please give the suggesations how to do this Thanks in advance
how to configure celery executing tasks concurrently from on queue
30,216,495
3
3
1,110
0
python,concurrency,celery
To put it simply concurrency is the number of jobs running on a worker. Prefetch is the number of job sitting in a queue on a worker itself. You have 1 of 2 options here. The first is to set the prefetch multiplier down to 1. This will mean the worker will only keep, in your case, 8 additional jobs in it's queue. The second which I would recommend would be to create 2 different queues one for your short running tasks and another for your long running tasks.
0
1
0
0
2015-05-13T11:22:00.000
1
1.2
true
30,213,356
0
0
0
1
In an environment with 8 cores, celery should be able to process 8 incoming tasks in parallel by default. But sometimes when new tasks are received celery place them behind a long running process. I played around with default configuration, letting one worker consume from one queue. celery -A proj worker --loglevel=INFO --concurrency=8 Is my understanding wrong, that one worker with a concurrency of 8 is able to process 8 tasks from one queue in parallel? How is the preferred way to setup celery to prevent such behaviour described above?
python changing keyboard language in Mac OS X
66,572,892
0
2
765
0
python,macos,keyboard
Calling xkbswitch from python using subprocess would probably be easier than the other solutions you find here.
0
1
0
0
2015-05-13T18:50:00.000
3
0
false
30,223,012
1
0
0
1
I wrote python software that requires both german and english input. Currently, I am using the Mac shortcut cmd-space to quickly change keyboard layouts, but I need to do this hundreds of times, which slows things down. Since I know exactly when English vs German input is needed, is there a way to programmatically change the keyboard language in python? I am using Mac OS X Yosemite.
debian wheezy console application set font size
30,232,512
0
0
153
0
python,debian,raspberry-pi
you can not do this. font size is determined by terminal emulator not program output.
0
1
0
1
2015-05-14T07:06:00.000
2
0
false
30,231,345
0
0
0
1
How do I set font size for Python console application? I'm running Debian Wheezy on a Raspberry Pi. When the program is exited return to default size.
Select python version to execute from prompt
30,237,541
0
0
79
0
python,command-prompt,prompt
There are multiple ways to go about this. As Sir_FZ pointed out, the executables are already named python2.7, etc, so what you want already exists. If for some really odd reason you have more than one python2.7 in your $PATH, you can explicitly call /my/other/python2.7 etc. If you're lazy, you can even create alias's alias p2=/my/other/python2.7 and then you can call p2 setup.py install If you're going to be doing this for more than a day, I'd suggest following one of Sagar's links.
0
1
0
0
2015-05-14T10:49:00.000
2
0
false
30,235,427
1
0
0
1
I have several python versions installed (and working properly on my machines). Isn't there a way to execute a specific version of python from the command line. Say I want to use python 3.1. I am after something a SIMPLE COMMAND such as python3.1 or python31 that would be used as follows :python3.1 setup.py install, for instance. [pip has pip3.1 to install a library with the version 3.1 of python, specifically]
Run multiple Celery chains at the same time
30,300,802
1
0
678
0
python,django,celery
If you want to run chains at once you will need to run more than one worker.
0
1
0
0
2015-05-15T19:21:00.000
1
1.2
true
30,267,236
0
0
1
1
I have Celery tasks chain that I call with apply_async. Each task in chain depends on the result from previous task. Basically the worklof looks like this: Fetch data from DB. For each fetched row run chain with tasks. Behaviour that I want to achieve is to run multiple chains at one time. But it seems like it runs them in a row, not simultaneously. How to fix this issue?
Distributed Task Queue Based on Sets as a Data Structure instead of Lists
30,282,486
1
8
656
0
python,redis,rabbitmq,celery,message-queue
Can your tasks in stage 2 check whether the work has already been done and, if it has, then not do the work again? That way, even though your task list will grow, the amount of work you need to do won't. I haven't come across a solution re the sets / lists, and I'd think there were lots of other ways of getting around this issue.
0
1
0
0
2015-05-16T16:26:00.000
3
0.066568
false
30,278,054
0
0
1
1
I'm wondering if there's a way to set up RabbitMQ or Redis to work with Celery so that when I send a task to the queue, it doesn't go into a list of tasks, but rather into a Set of tasks keyed based on the payload of my task, in order to avoid duplicates. Here's my setup for more context: Python + Celery. I've tried RabbitMQ as a backend, now I'm using Redis as a backend because I don't need the 100% reliability, easier to use, small memory footprint, etc. I have roughly 1000 ids that need work done repeatedly. Stage 1 of my data pipeline is triggered by a scheduler and it outputs tasks for stage 2. The tasks contain just the id for which work needs to be done and the actual data is stored in the database. I can run any combination or sequence of stage 1 and stage 2 tasks without harm. If stage 2 doesn't have enough processing power to deal with the volume of tasks output by stage 1, my task queue grows and grows. This wouldn't have to be the case if the task queue used sets as the underlying data structure instead of lists. Is there an off-the-shelf solution for switching from lists to sets as distributed task queues? Is Celery capable of this? I recently saw that Redis has just released an alpha version of a queue system, so that's not ready for production use just yet. Should I architect my pipeline differently?
Is there a way to run a Google App engine cron task without hitting an endpoint but rather pointing cron.yaml at a python script?
30,280,609
2
0
622
0
python,google-app-engine,google-cloud-storage
A cron job in GAE has to hit a URL, there's no other way to do it. That's just how the system is designed. But since you have control over app.yaml anyway, you can easily assign your script to a URL there.
0
1
0
1
2015-05-16T20:32:00.000
2
0.197375
false
30,280,460
0
0
1
1
my end goal is to update Google cloud storage with some json data and I would rather it run a script rather than hitting a url endpoint. What would be the proper configuration of cron.yaml if, let's say the script were to sit right next to app.yaml?
Running python script on Microsoft Azure
30,571,753
2
2
4,731
0
python,azure,cloud,bigdata,azure-virtual-machine
There is no additional steps to do in comparison to Your own. local server. Linux on Azure is a standard Linux machine. If You are looking for step-by-step hopw to on running Linux VM on Azure, just search on azure.com and You will find it. I think You will not have any problems even without documentation. Azure portal is very simple to use, also CLI tool for Linux, Mac and Windows. You just need to run Linux VM and SSH-in to it. Nothing more. If You need some help, just write here.
0
1
0
0
2015-05-17T22:39:00.000
1
1.2
true
30,292,884
1
0
0
1
I'll have a linux machine with a virtual machine installed for Microsoft azure soon. I need to run some data mining/graph analysis algorithms on the azure because I work with big data. I don't want to use azure machine learning stuff. just want to run my own python code. What are the steps? If needed, hoe can I install python libraries on azure?
How to remove .pyo anc .pyc from an RPM?
30,325,775
4
3
5,993
0
python,rpm
The *.pyc and *.pyo are being automagically compiled by helper scripts in rpm. The simplest way to disable is to add "exit 0" at the end of the %install section to disable the running of the helper scripts Otherwise you will need to change your build configuration and redefine the macros that are being appended to the %install script let when building.
0
1
0
0
2015-05-19T05:12:00.000
2
0.379949
false
30,317,213
1
0
0
1
I have a proxy written in python. I want to create an RPM for this. This rpm will just place the appropriate files at their location. and then some python server will pick them. Now my question is that whenever I generate the rpm, I am getting .pyo and .pyc files as well for every .py file. I don't need those pyc and pyo files. Is there any flag or anything that I can do to remove them? Thank you.
Python: How to handle 'crontab' command?
30,319,952
0
2
6,083
0
python,linux,ubuntu,cron,crontab
If all you want to do is reset the content of user crontab file , then just remove the crontab file (or overwrite with your default) , and reload the cron service .
0
1
0
0
2015-05-19T06:24:00.000
5
0
false
30,318,168
0
0
0
2
We know the crontab command is used for scheduled tasks in Linux. I want to write a Python script. Its function is to receive some data (these data are related to crontab setting) and execute a 'crontab' command in order to reset the content of the user's crontab file. I know how to execute external Linux commands in Python. But when you execute the crontab command (e.g. crontab -u xxx -e), you need to interact with an editor to modify the user's crontab file. (Suppose I don't know where the file is. For new users, crontab will generate a new file anyway. And I don't execute the command as the root user). So the question is, how can I just execute crontab in Python? Is there any way to avoid interacting with an editor to modify the user's crontab file in Python? My OS is ubuntu 14.01.
Python: How to handle 'crontab' command?
30,319,851
0
2
6,083
0
python,linux,ubuntu,cron,crontab
You could/should first dump your current crontab with crontab -l, edit it the way you want (e. g. add some lines, or modify) and then install the new one. This usually works with crontab <filename>, but should as well work with crontab - and then piping the new contents into the process's stdin.
0
1
0
0
2015-05-19T06:24:00.000
5
0
false
30,318,168
0
0
0
2
We know the crontab command is used for scheduled tasks in Linux. I want to write a Python script. Its function is to receive some data (these data are related to crontab setting) and execute a 'crontab' command in order to reset the content of the user's crontab file. I know how to execute external Linux commands in Python. But when you execute the crontab command (e.g. crontab -u xxx -e), you need to interact with an editor to modify the user's crontab file. (Suppose I don't know where the file is. For new users, crontab will generate a new file anyway. And I don't execute the command as the root user). So the question is, how can I just execute crontab in Python? Is there any way to avoid interacting with an editor to modify the user's crontab file in Python? My OS is ubuntu 14.01.
Pip.exe from Python on Windows 10
31,065,211
18
7
18,024
0
python,windows,python-3.x,windows-10
You can use python -m pip install package
0
1
0
0
2015-05-19T20:04:00.000
2
1
false
30,335,122
1
0
0
1
I installed the latest version of Python from www.python.org. Python 3.4.3. I then go to run pip and I get "Fatal error in launcher: Job information querying failed" Searching for this error message points me to similar issues running Python under wine. If you grab a pre-compiled pip.exe it will work but it seems that when you install, the pip.exe is generated as part of the installer and this pip.exe does not work. Further I am dealing with a build script that creates a virtual python environment that uses pip.exe and results in the same error. Not sure how to fix this. Also not sure how pip.exe is generated.
How can I monitor a python scrypt and restart it in the event of a crash? (Windows)
30,358,001
0
0
403
0
python,windows,monitoring
If there are no other mitigating factors in your design or requirements, my suggestion would be to simplify the script so that it doesn't do the polling; it simply sends the file when invoked, and use Windows Scheduler to invoke the script on whatever schedule you need. By relying on a core Windows service, you can factor that complexity out of your script.
0
1
0
1
2015-05-20T15:52:00.000
2
1.2
true
30,354,621
0
0
0
1
I have a simple python script to send data from a Windows 7 box to a remote computer via SFTP. The script is set to continuously send a single file every 5 minutes. This all works fine but I'm worried about the off chance that the process stops or fails and the customer doesn't notice the data files have stopped coming in. I've found several ways to monitor python processes in a ubuntu/unix environment but nothing for Windows.
Tornado ioloop + threading
30,362,810
3
5
4,428
0
python,http,tornado,web-frameworks
The vast majority of Tornado apps should have only one IOLoop, running in the main thread. You can run multiple HTTPServers (or other servers) on the same IOLoop. It is possible to create multiple IOLoops and give each one its own thread, but this is rarely useful, because the GIL ensures that only one thread is running at a time. If you do use multiple IOLoops you must be careful to ensure that the different threads only communicate with each other through thread-safe methods (i.e. IOLoop.add_callback).
0
1
0
0
2015-05-20T18:28:00.000
1
1.2
true
30,357,663
1
0
0
1
i have been working on tornado web framework from sometime, but still i didnt understood the ioloop functionality clearly, especially how to use it in multithreading. Is it possible to create separate instance of ioloop for multiple server ??
How to install requests module in Python 3.4, instead of 2.7
53,805,505
0
51
316,112
0
python-3.x,pip,python-requests
i just reinstalled the pip and it works, but I still wanna know why it happened... i used the apt-get remove --purge python-pip after I just apt-get install pyhton-pip and it works, but don't ask me why...
0
1
1
0
2015-05-21T00:29:00.000
6
0
false
30,362,600
1
0
0
2
I have both Python 2.7 and 3.4 installed on my Ubuntu 14.04 machine. I want to install the 'requests' module so it is accessible from Py3.4. When I issued pip install requests on my terminal cmd line I got back: "Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python2.7/dist-packages" How can I direct pip to install requests for 3.4 even though it is already in 2.7?
How to install requests module in Python 3.4, instead of 2.7
53,132,450
0
51
316,112
0
python-3.x,pip,python-requests
i was facing same issue in beautiful soup , I solved this issue by this command , your issue will also get rectified . You are unable to install requests in python 3.4 because your python libraries are not updated . use this command apt-get install python3-requests Just run it will ask you to add 222 MB space in your hard disk , just press Y and wait for completing process, after ending up whole process . check your problem will be resolved.
0
1
1
0
2015-05-21T00:29:00.000
6
0
false
30,362,600
1
0
0
2
I have both Python 2.7 and 3.4 installed on my Ubuntu 14.04 machine. I want to install the 'requests' module so it is accessible from Py3.4. When I issued pip install requests on my terminal cmd line I got back: "Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python2.7/dist-packages" How can I direct pip to install requests for 3.4 even though it is already in 2.7?
Python kill parent script (subprocess)
30,365,032
1
0
650
0
python,subprocess
You are doing this backwards, and shouldn't be using the child process to kill the parent process. Instead, you will want a parent process of your "perpetually running" script (which will now be the subprocess). When an update is detected, the subprocess kills itself, and requests that the parent implement your changes. The parent will then restart the subprocess.
0
1
0
0
2015-05-21T05:04:00.000
1
1.2
true
30,364,981
1
0
0
1
Im working on two scripts. One script is perpetually running. When it senses an update to itself, it will run the second script as a subprocess. The second script should kill the first script, implement the changes and run the updated script. However, I cant find a way to kill the first script. How does the child process kill its parent?
Long-running Python process that accepts inputs from another non-Python process
30,365,943
1
0
25
0
python,objective-c,ipc
I would argue it's not the HTTP that adds a lot of overhead, but the TCP 3-way connection handshake. Having said that, a lot of systems use TCP for inter-process communication, so if you want to use HTTP, it's only a very small extra load on top. Of course with HTTP, you are creating a new connection with each request, however this is not so bad - you should be able to make each HTTP call within 1 or 2ms. With HTTP comes a lot of nice properties like not having to maintain a persistent TCP connection, a ton of great libraries to easily make/receive your requests, and the request/response model seems to suit your system needs.
0
1
0
0
2015-05-21T06:10:00.000
1
0.197375
false
30,365,807
1
0
0
1
I'm designing a system like this: a Python process (let's call it "server") accepts inputs from another process ("client", written in Objective-C) on the same machine and returns outputs to the client. What's a good architecture for this system? I mean, what's a good protocol for server/client communication? I think making the server an HTTP service is overkill because the client always lives on the same machine.
virtualenv does not get activated in new bash shell
30,397,334
2
1
580
0
linux,python-2.7,terminal,virtualenv
You have to activate the virtualenv in every shell, or, as 0range suggested, activate it in your .bashrc or any script running before your shell displays the prompt. To add it to your .bashrc : Edit /home/youruser/.bashrc and add the line : source /path/to/bin/activate Open a new shell or source ~/.bashrc Everything should be alright.
0
1
0
0
2015-05-22T12:12:00.000
1
1.2
true
30,396,430
1
0
0
1
I activate python virtualenv in one bash and tries to use in another bash shell. virtualenv simply does not work. I opened a terminal, activate the virtualenv through sourcing activate file. It got activated in my terminal it shows () in front of terminal address. I opened a new terminal. The effect is not visible in the newly opened terminal. Anyone here help me please?
How can I run python in terminal on a mac?
30,408,184
1
3
35,838
0
python,macos
python command will open a Python interpreter, where you can't run the python hello.py command so you got the syntax error (to run hello.py in python shell you need execfile(hello.py)) to quit the Python interpreter, type ctrl+d and than python hello.py to execute your hello world script.
0
1
0
0
2015-05-23T01:57:00.000
3
0.066568
false
30,408,127
0
0
0
1
I'm extremely new to programming, in fact I'm trying to learn Python now as a first language. I found that Google has a python course and it said to download python 2 from python's website, which I did, and I now realize that python was already installed on my mac by apple. Anyways, I also had to download some exercises from google, and attempt to run some code in terminal and this is where I'm running into trouble and could really use some insight. First, the lesson said to simply type, python, into terminal to start coding in python (I don't know if this is the way to say that, or if that just gives you the ability to run python code?) Then, it said to type in: python hello.py Which was supposed to return: Hello World However, all I keep getting is : SyntaxError: Invalid Syntax And I don't really know where to go from here, I was thinking maybe it's due to me downloading python again when it was already installed, if it even was?
Python/ Apache Help needed
30,408,643
0
1
28
0
python,apache
Here is how I would take the approach based on what you just asked. Server: Apache + mod_wsgi for front-end web server (allows for using flask or django); there's not much here, it's a pretty easy configuration. I would use Django for the web framework. Client: Client would poll the server at some kind of interval (1 minute, 10 minutes, etc.); upon poll the client would receive commands that it would then execute from the server. I'm not sure if there is a keylogging module in python; if there isn't one I'd have to write one for each of the OS's I intended for the client to be on in C. I'm going with pull requests because firewalls rarely do egress filtering; they will always do inbound filtering virtually by default and therefore the way you asked how to set this is up initially will not work. This is actually how most botnets work (take a look at Chrome for example).
0
1
0
1
2015-05-23T03:19:00.000
1
0
false
30,408,568
0
0
0
1
I am trying to make a program (well more like two programs that work together) A. The server(host): which is connected to the Apache server and sends commands to it and B. The Client(client): which is also connected but cant send commands only receive them. Example: If I typed in the server(host). Log time it would send that command to the apache server and the client would grab the time and send me back the details to the (host). Example 2: If I typed start keylogger -t 2000 (-t is time and 2000 is every 2000 mseconds) in the server(host) it would start the built in keylogger and start sending logged info every 2000 mseconds. If I typed I am not a first time programmer. I write usually in c#/ ruby. Python is my first language so I understand what you have for me just I have never really used Apache before. Any help would be very appreciated!
Debugging ANT script initiated via a Python script
30,913,800
0
0
112
0
python,eclipse,debugging,ant,pydev
When dealing with multiple languages, the way for debugging is regular debugging in one and remote debugging in the other... I'm guessing the ant debug uses the regular java debug which supports remote debugging, so, you can probably try that (although I haven't tried it here to confirm).
0
1
0
1
2015-05-23T12:06:00.000
1
0
false
30,412,458
0
0
1
1
I have a set of Python scripts that sets up various parameters/properties for ANT script based on various conditions that are checked in the Python scripts and then invokes/executes the appropriate ANT build script. I initiate the Python script from my Eclipse IDE. I have the PyDev plug-in installed in Eclipse. I am able to debug the python script but cannot debug the ANT scripts, maybe because it doesn't get invoked as 'Run ANT Script'. Is there a way to debug an ANT script initiated by Python (or any other mechanism for that matter)?
how do you disable a text command from another text command in Sublimetext
30,431,423
0
0
65
0
python,sublimetext3,sublimetext,sublime-text-plugin
After another 5 hours of reading, I figured it out. As I assumed, it was a lack of Python knowledge on my part. All I needed to do was create a module level variable to use as a flag.
0
1
0
0
2015-05-24T21:01:00.000
1
0
false
30,428,292
0
0
0
1
I'm creating a plugin in sublime Text 3, and I've hit a snag that I can't figure out. This is my first using python, and the first time I've done even driven desktop development in over a decade, so hopefully this is just a lack of knowledge on my part. The plugin I'm writing uses text commands to gather data and then uses that data to call another text command that starts a subprocess than can run for a significant period of time depending on the arguments passed. the following is some simplified code. class BlaOneCommand(sublime_plugin.TextCommand): def run(self, edit): commandArgs = [] self.view.run_command('run_command', {"args": commandArgs}) class BlaTwoCommand(sublime_plugin.TextCommand): def run(self, edit): commandArgs = [] self.view.run_command('run_command', {"args": commandArgs}) class BlaThreeCommand(sublime_plugin.TextCommand): def run(self, edit): commandArgs = [] self.view.run_command('run_command', {"args": commandArgs}) class BlaRunCommand(sublime_plugin.TextCommand): def run(self, edit, args): self.commandArgs = args sublime.set_timeout_async(self.runCommand, 0) def runCommand(self): proc = '' if os.name == 'nt': startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW proc = subprocess.Popen(self.commandArgs, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False, startupinfo=startupinfo) else: proc = subprocess.Popen(self.commandArgs, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False) while proc.poll() is None: try: data = proc.stdout.readline().decode(encoding='UTF-8') print(data, end="") except: return; BlaOne, BlaTwo, & BlaThree are set up in a context menue. and what I need to do is disable some or all of them while the subprocess is running. I know this can be done by overriding the is_enabled method. However I'm struggling with how to tie them all together. How can I make all the objects aware of each other, so they can enable/disable each other?
Is there a more efficient way to satisfy project dependencies than pip?
30,434,337
2
1
55
0
python,linux,django,dependencies,pip
For god's sake, please do not fall back to using the distribution's package manager just because your hosting guys do not understand what pip+virtualenv is good for. Python packages in Linux distribution repositories are often outdated and may come with quirks that other Python package authors did not plan for. This is especially true for Python packages with compiled code. If a documentation tells you that a certain dependency should be obtained directly from PyPI via pip, then you better follow that requirement. Convince your hosting guys to use the right tools, namely pip combined with virtualenv. The latter will create an isolated environment and make sure that the system will stay clean (really, nobody needs to do a sudo pip install, which probably is the thing your hosting guys are afraid of).
0
1
0
1
2015-05-25T08:31:00.000
1
1.2
true
30,434,106
1
0
0
1
I work on a system and the hosting guys don't want to use an install script that uses pip. Now we have a large pip requirements file that install the dependencies. Is there any other way to do it than using pip? Can it be done using yum or apt-get ? We are using Linux.
pty.fork() error python pexpect
32,283,501
0
1
731
0
python,cgi,pexpect
ExceptionPexpect(\'Error! pty.fork() failed: \' + str(e))\npexpect.ExceptionPexpect: Error! pty.fork() failed: out of pty devices\')') your system has reached the max # of pty devs. your should increase those according to your needs. keep in mind, for resource & security reasons it shall be useful to limit access to pty to the specific script user.
0
1
0
1
2015-05-26T12:19:00.000
1
0
false
30,458,394
0
0
0
1
I am using pexpect with cgi to ssh into remote machine, Whenever i run a script which does ssh using pexpect from the linux terminal it gives me the correct result, but when i call the script using commands module from the cgi program i am getting the following error. (0, '(256, \'Traceback (most recent call last):\n File "/usr/local/https/pro.py", line 85, in \n main()\n File "/usr/local/https/pro.py", line 66, in main\n mac = RemoteCommand(command,passwd)\n File "/usr/local/https/pro.py", line 42, in RemoteCommand\n child = pexpect.spawn(command)\n File "/usr/lib/python2.5/site-packages/pexpect.py", line 375, in init\n self.__spawn()\n File "/usr/lib/python2.5/site-packages/pexpect..py", line 446, in __spawn\n raise ExceptionPexpect(\\'Error! pty.fork() failed: \\' + str(e))\npexpect.ExceptionPexpect: Error! pty.fork() failed: out of pty devices\')')
How to check all versions of python installed on osx and centos
30,465,953
4
75
184,308
0
python,linux,macos,centos,version
As someone mentioned in a comment, you can use which python if it is supported by CentOS. Another command that could work is whereis python. In the event neither of these work, you can start the Python interpreter, and it will show you the version, or you could look in /usr/bin for the Python files (python, python3 etc).
0
1
0
1
2015-05-26T17:18:00.000
12
0.066568
false
30,464,980
0
0
0
4
I just started setting up a centos server today and noticed that the default version of python on centos is set to 2.6.6. I want to use python 2.7 instead. I googled around and found that 2.6.6 is used by system tools such as YUM so I should not tamper with it. Then I opened up a terminal on my mac and found that I had python 2.6.8 and 2.7.5 and 3.3.3 installed. Sorry for the long story. In short I just want to know how to lookup all the version of python installed on centos so I don't accidentally install it twice.
How to check all versions of python installed on osx and centos
58,172,493
4
75
184,308
0
python,linux,macos,centos,version
COMMAND: python --version && python3 --version OUTPUT: Python 2.7.10 Python 3.7.1 ALIAS COMMAND: pyver OUTPUT: Python 2.7.10 Python 3.7.1 You can make an alias like "pyver" in your .bashrc file or else using a text accelerator like AText maybe.
0
1
0
1
2015-05-26T17:18:00.000
12
0.066568
false
30,464,980
0
0
0
4
I just started setting up a centos server today and noticed that the default version of python on centos is set to 2.6.6. I want to use python 2.7 instead. I googled around and found that 2.6.6 is used by system tools such as YUM so I should not tamper with it. Then I opened up a terminal on my mac and found that I had python 2.6.8 and 2.7.5 and 3.3.3 installed. Sorry for the long story. In short I just want to know how to lookup all the version of python installed on centos so I don't accidentally install it twice.
How to check all versions of python installed on osx and centos
56,606,519
20
75
184,308
0
python,linux,macos,centos,version
we can directly use this to see all the pythons installed both by current user and the root by the following: whereis python
0
1
0
1
2015-05-26T17:18:00.000
12
1
false
30,464,980
0
0
0
4
I just started setting up a centos server today and noticed that the default version of python on centos is set to 2.6.6. I want to use python 2.7 instead. I googled around and found that 2.6.6 is used by system tools such as YUM so I should not tamper with it. Then I opened up a terminal on my mac and found that I had python 2.6.8 and 2.7.5 and 3.3.3 installed. Sorry for the long story. In short I just want to know how to lookup all the version of python installed on centos so I don't accidentally install it twice.
How to check all versions of python installed on osx and centos
30,466,232
7
75
184,308
0
python,linux,macos,centos,version
Use, yum list installed command to find the packages you installed.
0
1
0
1
2015-05-26T17:18:00.000
12
1.2
true
30,464,980
0
0
0
4
I just started setting up a centos server today and noticed that the default version of python on centos is set to 2.6.6. I want to use python 2.7 instead. I googled around and found that 2.6.6 is used by system tools such as YUM so I should not tamper with it. Then I opened up a terminal on my mac and found that I had python 2.6.8 and 2.7.5 and 3.3.3 installed. Sorry for the long story. In short I just want to know how to lookup all the version of python installed on centos so I don't accidentally install it twice.
importing Twilio on google app engine
30,514,752
0
0
275
0
python,google-app-engine,twilio
Thanks for the input. I had already tried all of these things. When I ran the app on a local host I saw in the console that the error I was facing was with 'pytz' Turns out that Twilio requires the Pytz dependency to be in the root directory of Google App Engine. They have not updated the documentation yet. Hope that helps anyone in the future.
0
1
0
1
2015-05-27T09:39:00.000
3
1.2
true
30,478,647
0
0
1
1
I've seen other similar questions but none of the solutions are working for me. I am trying to get Twilio working with Google App Engine. I am using the python API and can't seem to get it to work. I tried a few tactics: used pip install twilio downloaded the twilio file directly into my root directory sym linked the required files according to a few tutorials nothing seems to work. When I write the line "import twilio.twiml" it makes the google app engine crash and say "error: server error: What is the best way to import Twilio and load into the google app engine server?
Remote Debug of Celery using rdb
34,818,641
2
1
666
0
python,celery
For anyone who has this problem and finds their way here from google, I can't explain why rdb drops you into the middle of contextlib but I have found that if you execute the r(eturn) command a couple times you'll work your way back into the function you made your rdb.set_trace() call from.
0
1
1
0
2015-05-27T15:25:00.000
1
1.2
true
30,486,773
0
0
0
1
I'm trying to do some debuging on celery task using rdb but despite the fact that I can connect to the socket using telnet it doesn't give me any data, looks like Pdb is broken and doesn't have any data to inspect It starts with this lane c:\python27\lib\contextlib.py(21)exit()-> def exit(self, type, value, traceback):(Pdb) My setup is RabbitMQ and Celery running on localhost together with python virtual env Any idea what may be wrong with it?
Powershell not finding a file with a .py extension
30,516,327
0
1
173
0
python,powershell
I got it to work finally, I had it in a folder under the path C:\Users\MyUser\PythonTest\ex1.py This was wrong, however when I made it C:\Users\MyUser\ex1.py It worked, thanks for all the help!
0
1
0
1
2015-05-27T23:56:00.000
2
0
false
30,495,055
1
0
0
1
I am using Zed Shaw's "Learn Python the Hard Way" and have gotten Python to work. I made a file and saved it as ex1.py. I type the command python ex1.py This does not recognize the file like it should and instead gives me this can't open file 'ex1.py': [Errno 2] No such file or directory I have checked and double-checked it. There is definitely a ex1.py file saved in my Local Disk (C:). None of the common errors on his tutorial include mine. Any tips?
Convert script to executable, python not in registry
30,521,807
0
0
297
0
python,windows,exe
I fixed the issue. Apparently I accidentally installed 32-bit Python on a 64-bit machine. So I have to use the 32-bit installer because it installs the registry key in a different place. Thanks for the help anyways.
0
1
0
1
2015-05-28T05:44:00.000
2
0
false
30,498,106
1
0
0
1
I am trying to convert a python script to an executable file. I have tried cxFreeze and py2exe, but both told me that Python27 are not in the registry. I found several other questions that tell me to go to regedit and find the python folder, but it is not there. I tried going to HKEY_CURRENT_USER/Software and Python27 was not there. Do I need to add it there to run the installer for cxFreeze or py2exe or is there another way?
VIM + netrw: open multiple files/buffers in the same window
30,533,662
3
2
3,905
0
python,vim,nerdtree,python-mode,netrw
But having a file opened, if I open netrw by typing :E and open another file by hitting <enter> VIM closes the old one and opens the new one in the same window. [...] How can I open multiple files/buffers in the same window using netrw? Buffers are added to a list, the buffer list, and facultatively displayed in one or more window in one or more tab pages. Since a window can only display one buffer, the only way to see two separate buffers at the same time is to display them in two separate windows. That's what netrw's o and v allow you to do. When you use <CR>to edit a file, the previous buffer doesn't go away: it is still in the buffer list and can be accessed with :bp[revious].
0
1
0
0
2015-05-29T15:18:00.000
3
1.2
true
30,533,263
1
0
0
1
I have recently switched to VIM using NERDTree and python-mode. As NERDTree seems to have a conflict with python-mode and breaks my layout if I close one out of multiple buffers, I decided to switch to netrw since it is shipped with VIM anyway. But having a file opened, if I open netrw by typing :E and open another file by hitting <enter> VIM closes the old one and opens the new one in the same window. And if I hit <o> in the same situation VIM adds another buffer but adds a new window in a horizontal split. How can I add multiple files/buffers to the buffer list and only show the last added buffer in the active window (without new splits) using netrw? #edited# Thanks in advance! I hope I haven't missed something trivial from the manual.. ;-)
How can i install python on OSX?
30,543,046
1
1
36
0
python,macos
python is installed on OSX by default and you just need to open terminal and write ‘python’ command, then you can start your python coding
0
1
0
0
2015-05-30T06:23:00.000
1
1.2
true
30,543,041
1
0
0
1
I'm new to computer programming! I want to learn python and write my program and run it on my mac OS X machine. How can i setup python programming tools on OS X and how can i use that ? I before this never use any other programming language.
GAE - Share user authentication across apps
30,570,660
1
0
51
0
python,google-app-engine,flask,google-authentication,google-app-engine-python
You can't reuse the Users service authentication across different applications. A possible solution could be using a OAuth2 (or a similar mechanism) - create an application (or use one of you existing applications) which will be the authentication provider. Each application will redirect to the authentication provider where the user will get authenticated, and then redirected back. If the user is already authenticated, they will not need to authenticate again when switching applications. This way you won't be able to use the Users service on the end applications, only in the provider, so you will need to rely on another way to store the currently logged in user in each application (like datastore+memcache).
0
1
0
0
2015-06-01T08:17:00.000
1
0.197375
false
30,568,702
0
0
1
1
Let's say I run two different apps on different domains, coded in Python flask and running as GAE instances; one is site.co.uk and one is site.us. If I use the GAE authentication on one site is it possible to have them authenticated for the other site too? I don't really want to make them have to authenticate for each country specific domain.
Is Python 3.4 backwards compatible for 2.7 programs/libraries?
30,603,317
1
1
2,376
0
python,python-2.7,python-3.x
Minor versions of python are mostly backwards compatible, however major versions do not maintain backwards compatibility. There are many libraries that work with both, but the language itself does not make that guarantee.
0
1
0
0
2015-06-02T17:52:00.000
2
1.2
true
30,603,175
1
0
0
2
I am deciding whether to install python 3.4 or 2.7 on my home server running Ubuntu Server 14.04.2. I want to ensure that it has support from all the most used python libraries (scipy, numpy, requests, etc) but I am not sure how many of these packages fully support 3.4. Do all 2.7 packages work on 3.4? If no, what are the differences between the two that causes this errors?
Is Python 3.4 backwards compatible for 2.7 programs/libraries?
30,603,204
4
1
2,376
0
python,python-2.7,python-3.x
No, only packages specifically written to support both Python 2 and 3 will run on either. It is possible to write polyglot Python, but this requires effort from the library author. Code written for Python 2.7 will not automatically work on Python 3.
0
1
0
0
2015-06-02T17:52:00.000
2
0.379949
false
30,603,175
1
0
0
2
I am deciding whether to install python 3.4 or 2.7 on my home server running Ubuntu Server 14.04.2. I want to ensure that it has support from all the most used python libraries (scipy, numpy, requests, etc) but I am not sure how many of these packages fully support 3.4. Do all 2.7 packages work on 3.4? If no, what are the differences between the two that causes this errors?
Python Embed Web Server in Data Processing Node
32,857,200
0
0
124
0
python,python-2.7,flask,tornado,bottle
I would recommend you use a separate process for your app that will receive REST commands (use Pyramid or Flask), and have it send messages over RabbitMQ to the real time part. I like Kombu myself for interfacing with RabbitMQ, and your message bus will nicely decouple your web/rest needs from your event driven needs. Your event driven part just gets messages off the bus, and doesn't need to know anything about REST.
0
1
0
0
2015-06-03T04:28:00.000
1
0
false
30,610,850
0
0
1
1
I am working on a Python 2.7 project with a simple event loop that checks a variety of data sources (rabbitmq, mongodb, postgres, etc) for new data, processes the data and writes data to the next stage. I would like to embed a web server in the application so it can receive simple REST commands, for shutting it down, diagnosis etc. However, from reading the documentation on the available web servers it wasn’t clear if they will allow the event loop described above to function outside of the web server’s event loop. Ie. it looks like I would have to do something like launch the event loop using a REST call and have the loop live on an io thread, or similar. Can someone explain which embedded server (cherrypy, bottle, flask, etc) / concurrency framework (tornado, gevent, twisted etc.) are best suited for this problem? Thank you in advance!
How to run python from a network machine to local host?
30,611,798
0
1
2,012
0
python
The good part is: you have read access on the script. What you need is a python installation on your local machine and preferably a drive letter mapping to the script's folder. If not already mapped, this can be scripted with net use <letter>: \\<remote host>\<shared folder>. Then it's as easy as cd <letter>:\<path>\ ; python <script>.py. Then to the output of the script. Apparently it creates files. Can you supply the target folder on the script's command line? In that case just supply a local path.
0
1
1
0
2015-06-03T05:39:00.000
1
0
false
30,611,649
0
0
0
1
I've a python script in the network machine, I can open the network through explorer and have access to the script. Through that script from network,I want to create some folders/files and write/read some files in my localhost. Is there a way to do this in python?
Timing packets on a traffic server
30,647,917
1
0
57
0
python,unix,networking,network-programming,server
I always found it easier to utilize a switch's 'port mirror' to copy all data in and out of the proxy's switchport to a separate port that connects to a dedicated capture box, which does the tcpdump work for you. If your switch(es) have this capability, it reduces the load on the busy proxy. If they don't, then yes, tcpdump full packets to a file: "tcpdump -i interface -s 0 -w /path/to/file". You can then (on a different machine) throw together some code to examine and report on anything you want, or even open it in wireshark for detailed analysis.
0
1
1
0
2015-06-04T14:57:00.000
2
1.2
true
30,647,336
0
0
0
1
I have a proxy traffic server which is an extra hop on a network and is handling large quantity's of traffic. I would like to calculate the cost in seconds of how long it takes for the proxy server to handle the incoming request, process them and forward it on. I had been playing to write a python script to perform a tcpdump and some how time packets entering into the server until they had left. I would probably have to perform tcpdump for a certain period of time and then analysis it to calculate times? Is this a good way of achieving what I want or would there be a more elegant solution?
Serve dynamic data to many clients
30,648,878
0
0
29
0
python,vb.net
1) I am not very familiar with Python, but for the .net application you will likely want to push change notifications to it, rather than pull. The system.net.webclient.downloadstring is a request (pull). As I am not a Python developer I cannot assist in that. 3) As you are requesting data, it is possible to create some errors of the read/write while updating and reading at the same time. Even if this does not happen your data may be out of date as soon as you read it. This can be an acceptable problem, this just depends of how critical your data is. This is why I would do a push notification rather than a pull. If worked correctly this can keep data synced and avoid some timing issues.
0
1
0
0
2015-06-04T15:24:00.000
1
0
false
30,647,952
1
0
1
1
I am writing a client-server type application. The server side gathers constantly changing data from other hardware and then needs to pass it to multiple clients (say about 10) for display. The server data gathering program will be written in Python 3.4 and run on Debian. The clients will be built with VB Winforms on .net framework 4 running on Windows. I had the idea to run a lightweight web server on the server-side and use system.net.webclient.downloadstring calls on the client side to receive it. This is so that all the multi-threading async stuff is done for me by the web server. Questions: Does this seem like a good approach? Having my data gathering program write a text file for the web server to serve seems unnecessary. Is there a way to have the data in memory and have the server just serve that so there is no disk file intermediary? Setting up a ramdisk was one solution I thought of but this seems like overkill. How will the web server deal with the data being frequently updated, say, once a second? Do webservers deal with this elegantly or is there a chance the file will be served whilst it is being written to? Thanks.
Python Anaconda - "import cx_Oracle" error in command window
30,736,055
1
4
6,717
0
python,32bit-64bit,python-import,cx-oracle
I had the 32-bit version of oracle client installed. Once I installed the 64-bit version it worked fine.
0
1
0
0
2015-06-05T14:02:00.000
3
0.066568
false
30,668,532
0
0
0
1
I installed Python 2.7.7 :: Anaconda 2.0.1 (64-bit). Currently I am trying to run the command "import cx_Oracle". I ran easy_install which successfully add the cx_Oracle egg to the "site_packages" folder the anaconda directory getting the message "Installed c:\fast\anaconda\2.0.1\lib\site-packages\cx_oracle-5.1.3-py2.7-win-amd64".' Now whenever I try the command "import cx_Oracle" in the python terminal I get the error "ImportError: DLL load failed: %1 is not a valid Win32 application". I tried installing the specific 32-bit version of cx_Oracle but it still resulted in the same output "Installed c:\fast\anaconda\2.0.1\lib\site-packages\cx_oracle-5.1.3-py2.7-win-amd64". Has anyone had success fixing this?
Reinstall zlib on centos
30,797,283
0
0
79
0
python,zlib,centos5
I thought guys in here are much more active. anyway it ended up that I contacted my server company and they checked the hard disk and said that there is physical fault with the hard disk. I backed up my data on another server. they changed the hard disks and installed a fresh OS. now every thing's fine
0
1
0
0
2015-06-05T20:03:00.000
1
0
false
30,674,893
0
0
0
1
I faced "segmentation fault error" with "yum". Then I realised that there's a problem with zlib, but I messed it when trying to fix it. Now I need to reinstall zlib. since "yum" is no longer working I need to reinstall zlib through rpm or wget or some other way. could any one tell me the step by step procedure of reinstalling zlib?
nosetest not finding tests on cygwin
34,595,846
-1
1
218
0
python,cygwin,nose,nosetests
If you only have a single file with tests, you can launch it like this: nosetests tests.py
0
1
0
1
2015-06-06T09:54:00.000
1
-0.197375
false
30,681,408
0
0
0
1
I have a set of unit tests files created in python with unittest as the import. Running nosetests on both the terminal of MacOSX and on the cmd.exe of Windows 7, it finds the tests and runs them. Trying to execute nosetests under Cygwin does not find any tests to run. All three cases use the same version of Python (3.4) and the same version of nose(1.3.6). Also, none of the files are marked as executable I suspect that is something environmental on cygwin. Does anyone know that do I need to do?
python-sys.stdin.readlines() ,Stop reading lines in command line
30,685,708
1
1
2,456
0
python,python-3.x
1) sys.stdin is a TextIOWrapper, its purpose is to read text from stdin. The resulting strings will be actual strs. sys.stdin.buffer is a BufferedReader. The lines you get from this will be byte strings 2) They read all the lines from stdin until hitting eof or they hit the limit you give them 3) If you're trying to read a single line, you can use .readline() (note: no s). Otherwise, when interacting with the program on the command line, you'd have to give it the EOF signal (Ctrl+D on *nix) Is there a reason you are doing this rather than just calling input() to get one text line at a time from stdin?
0
1
0
0
2015-06-06T17:27:00.000
2
0.099668
false
30,685,632
1
0
0
1
I have a code with function sys.stdin.readlines(). What is the difference between the above one and sys.stdin.buffer.readlines()?. What exactly do they do ? If they read lines from command line,how to stop reading lines at a certain instant and proceed to flow through the program?
twisted.reactor callWhenRunning and callLater undefined?
30,689,289
1
1
436
0
python-2.7,twisted
Python data structures can change at runtime, so Eclipse can only guess what methods are available. In the case of twisted.internet.reactor, it is a singleton whose type may change depending on how things are initialized, so it appears to Eclipse as a blank module. Since PyDev for Eclipse does not provide a way for libraries to tell it that it's wrong about what methods it has detected, if your Python code does not match the subset of Python it can guess correctly about, then you get spurious errors like this. Sorry! If PyDev ever adds a way to override its built-in guessing logic, we will distribute something that says what methods twisted.internet.reactor likely provides. Please file a bug against PyDev for this.
0
1
0
0
2015-06-07T00:21:00.000
1
0.197375
false
30,688,827
0
0
0
1
I am working with twisted and...well these two methods keep coming up in Eclipse as undefined. Cannot find any reference to this. I tried #@UndefinedVariable (which solved the reactor.run() issue I had but it does not work in this case. Running Eclipse Kepler on Mac Yosemite with twisted-15.2.1 zope.interface-4.1.2.
PYTHON py2exe makes too many files.. how do I execute only one .EXE file?
30,699,958
0
0
280
0
python,exe,py2exe
Py2exe is a tool provides an exe application which can be run without installing python interpreter, after packaging you find your exe and dlls of interpreter and all modules... In dist folder. It does nt provide all in one exe, use pyinstaller instead
0
1
0
0
2015-06-07T23:56:00.000
2
0
false
30,699,683
1
0
0
1
After I make an exe file, there are many files such as .pyd that my exe depend on them.. I want to make a program with only one exe file which will be handie.. please help me
os.rename() gives permisson denied when python script launched from jenkins
30,706,914
0
0
1,541
0
python,jenkins
I think you're using relative path names. In that case it will default to the current working directory, which works when you run it manually, but may fail when Jenkins runs your code using a different working directory. The solution is to make sure that both the src and dst args to os.rename() are absolute paths, or alternatively to chdir() to the correct directory first.
0
1
0
0
2015-06-08T05:20:00.000
1
0
false
30,701,698
0
0
0
1
I am getting the following error when I launched my build script from jenkins os.rename(str1,str) OSError: [Errno 13] Permission denied Build step 'Execute shell' marked build as failure I am able to rename the file manually.I have rwx permissions on that file.But I could not do the same thing when python script launched from jenkins.Any ideas ?
Move python code to background after running a part of it
30,710,470
1
4
2,517
0
python,background-process
If you have the #!/bin/env python, and its permissions are set correctly, you can try something like nohup /path/to/test.py &
0
1
0
0
2015-06-08T13:14:00.000
2
0.099668
false
30,710,144
1
0
0
1
I have a python code, which has some part that needs to be run on foreground since it tells out if the socket connection was proper or not. Now after running that part the output is written into a file. Is there a way to move the running python code (process) automatically from foreground to background after running some definite steps in foreground, so that I can continue my work on terminal. I know using screen is a option but is there any other way to do so. Since after running a part on foreground, there won't be any output shown in the terminal, I don't want to run screen unnecessarily.
Unix: Have Python script constantly running best practice?
30,742,647
2
15
40,621
0
python,unix,ubuntu
I am not sure how "best practice" this is but you could do: Add the program to: /etc/rc.d/rc.local This will have the program run at startup. If you add an '&' to the end of the line it will be run in the background. If you dont want to run the program manually (not at startup) you could switch to another tty by pressing ctrl + alt + f1, (this opens tty1 and will work with f1 - f6) then run the command. This terminal you do not have to have open in a window so you dont have to worry about it getting closed. To return to the desktop use ctrl + alt + f7.
0
1
0
1
2015-06-09T20:47:00.000
4
0.099668
false
30,742,533
0
0
0
1
I have a Python script which process data off of a HTTP data stream and I need this script to in theory be running at all times and forever unless I kill it off manually to update it and run it again. I was wondering what the best practice to do this was on a Unix (Ubuntu in particular) so that even if Terminal is closed etc the script continues to run in the background unless the process or server are shut down? Thanks
py2exe: Allow a console window to be either shown or hidden with a sys.argv
30,759,966
1
0
66
0
python,user-interface,console,pyside,py2exe
This is not a py2exe limitation, but a Windows limitation. On Windows, applications are compiled either as Console Applications or GUI Applications. The difference is that Console Applications always open a console window, whilst GUI Applications never do. As far as I can tell, it's not possible to have an application with dual functionality. As a workaround, I suggest that you simply compile two executables: one for console use and one for GUI use.
1
1
0
0
2015-06-10T14:45:00.000
1
0.197375
false
30,759,749
1
0
0
1
I have a python program using PySide. When run normally, it opens up a PySide GUI, but when run with some flags in the command line, it spits some things out in the console window. I'd like to retain this dual functionality, but it seems with py2exe you have to choose whether to have a console window or not when compiling, with no option for choosing during program execution. Is what I want to do possible with py2exe, or even with some other python "compiler?"
Using Jmeter OS Process Sampler to collect script data
30,803,435
1
0
1,555
0
python,command,jmeter
Hi you just have to print the data you need to pass to jmeter, and then use one (or more) regular expression to extract values.
0
1
0
0
2015-06-10T15:52:00.000
2
0.099668
false
30,761,322
0
0
1
1
Is it possible to collect the output of a python script using the "OS Process Sampler"? My python script does a database query and returns "r1=123 r2=456 r3=789" Is there a way to collect the r1, r2, r3 values and graph them?
Navigating Directories and Counting files in a directory with Python
30,769,638
0
0
57
0
python,parsing,directory
len(os.listdir('path')) will give you the total number of entries at 'path' (this includes files and directories). As far as I know, the os module is platform independent, however the strings used for paths are different for windows and unix-based environments (and maybe others, I don't know). Windows path strings should look like 'C:\\directory\\subdir\\file' because backslashes need to be escaped. I can't remember off the top of my head but I think linux path strings are just like you'd expect them to be: 'directory/subdir/file'.
0
1
0
0
2015-06-10T23:20:00.000
1
1.2
true
30,768,970
1
0
0
1
I am fairly familiar with Python and coding in general but I do not have much experience with the parsing and directory navigation in Python. I have a file that contains some data that I wish to extract and I want to be able to count the number of files and directories in given directory. I have done a little research and I think the sys and os.path modules will be useful. Also do the commands for os.path vary across platforms(Yosemite vs. Linux. Windows)
schedule automate shell script running not as ROOT
30,956,053
0
0
164
0
python,linux,shell,unix,linux-kernel
In a pinch, you can use at(1). Make sure the program you run reschedules the at job. Warning: this goes to heck if the machine is down for any length of time.
0
1
0
1
2015-06-11T09:24:00.000
4
0
false
30,776,719
0
0
0
3
I have a shell script that I want to run automatically every day at 08 AM, and I am not authorised to use the crontab because I don't have root permission My home directory is /home/user1/. Any suggestions?
schedule automate shell script running not as ROOT
30,777,116
0
0
164
0
python,linux,shell,unix,linux-kernel
I don't think root permission is required to create a cron job. Editing a cronjob that's not owned by you - there's where you'd need root.
0
1
0
1
2015-06-11T09:24:00.000
4
0
false
30,776,719
0
0
0
3
I have a shell script that I want to run automatically every day at 08 AM, and I am not authorised to use the crontab because I don't have root permission My home directory is /home/user1/. Any suggestions?
schedule automate shell script running not as ROOT
30,776,928
0
0
164
0
python,linux,shell,unix,linux-kernel
Even if you dont have root permission you can set cron job. Chcek these 2 commands as user1, if you can modify it or its throwing any error. crontab -l If you can see then try this as well: crontab -e If you can open and edit, then you can run that script with cron. by adding this line: * 08 * * * /path/to/your/script
0
1
0
1
2015-06-11T09:24:00.000
4
0
false
30,776,719
0
0
0
3
I have a shell script that I want to run automatically every day at 08 AM, and I am not authorised to use the crontab because I don't have root permission My home directory is /home/user1/. Any suggestions?
ImportError: DLL load failed: %1 is not a valid Win32 application Only When Outside Python27 Directory
30,790,972
0
1
1,173
0
python,windows,importerror,pythonpath,sys.path
So for reference the source of the issue was residue from an old Enthought Canopy installation. The computer was using that installation of python (which didn't have the 3rd party libraries installed) instead of the one in Python27. I deleted that install from the system path and restarted the command prompt and now all is well.
0
1
0
0
2015-06-11T19:46:00.000
2
0
false
30,790,073
1
0
0
1
I have an odd variation of the common "ImportError: DLL load failed: %1 is not a valid Win32 application" error. I only get this error when I try to import a 3rd party library while run a python script outside of the python27 directory. For instance, if I do "import numpy" while inside python27, it works fine, but if I try to import numpy while in any other directory, I get the above error. Essentially I can run "python" in any directory, but can only import 3rd party libraries if I run it from the python27 directory. If anyone has any ideas as to why this would be, I'd be very appreciative. Here's some information about my system paths. Applicable Windows System Paths: PYTHONPATH = C:\Python27\Lib PYTHONHOME = C:\Python27 sys.path is equal to: ['', 'C:\Python27\Lib', 'C:\WINDOWS\SYSTEM32\python27.zip', 'C:\Python27\DLLs', 'C:\Python27\lib\plat-win', 'C:\Python27\lib\libtk', 'C:\Python27', 'C:\Python27\lib\site-packages', ' C:\Python27\lib\site-packages\win32', 'C:\Python27\lib\site-packages\win32\lib', 'C:\Python27\lib\site-packages\Pythonwin'] And if I run win_add2path.py I get: No path was added PATH is now: C:\Users\Mike\AppData\Local\Enthought\Canopy\User;C:\Users\Mike\AppData\Local\Enthought\Canopy\User\Scripts;C:\Python27;C:\Python27\Scripts Expanded: C:\Users\Mike\AppData\Local\Enthought\Canopy\User;C:\Users\Mike\AppData\Local\Enthought\Canopy\User\Scripts;C:\Python27;C:\Python27\Scripts Part of me feels that the Enthought Canopy path is screwing it up (that directory no longer exists), but the Python27 path is also there so it shouldn't be an issue... EDIT: I believe I now know what is causing the problem, but not how to fix it. So apparently there was a python.exe in the enthought canopy folder, and this is the one my comptuer was using, not the one in python27 (which is weird because I uninstalled enthought canopy). However, my computer now can't find the python.exe in python27 even though that directory is added to my system path... It gives me the old "python is not recognized as an internal or external command" shindig. Edit Well, I restarted the command prompt and now it works... I guess the removal of the enthought canopy path variable hadn't taken affect yet.
Nginx + FastCGI with blocking calls
30,792,360
1
0
345
0
python,nginx,fastcgi
Nginx talks to a fastcgi process over a socket connection. If the fastcgi process blocks, that means that it won't be sending data over the socket. This won't block nginx as such, because it keeps processing events (data from other connections). It uses non-blocking techniques like select, poll or equivalent OS-dependent functions (with a timeout) to query sockets without blocking. But it will stall whatever client is waiting for the fastcgi output.
0
1
0
1
2015-06-11T20:42:00.000
1
0.197375
false
30,791,066
0
0
0
1
The main advantage of Nginx is cited as it not needing to spawn separate threads for each request it receives. Now, if we were to run a python based web application using FastCGI, and this web application has blocking calls, would this create a bottleneck? Since there is only a limited number of workers running(1 per processor?), wont a blocking call by a python script make it cooperative multiprocessing?
Google App Engine : Wrong Serving Url
30,824,576
0
0
50
0
image,google-app-engine,google-app-engine-python,serving
Try specifying size=0 in the images.get_serving_url method call. eg. images.get_serving_url(blob_key, size=0)
0
1
0
0
2015-06-13T08:40:00.000
1
0
false
30,816,730
0
0
1
1
I have created a Google App Engine project where it's possible to upload photos. Uploading part is working fine and all the photos are uploaded in proper size. But when I try getting images.get_serving_url , it returns me serving_url appended with lh3.googleusercontent.com but according to GoogleAppEngine documentation it must return serving_url something like lh3.gghpt.com . Also, the problem which comes is that the photos on that serving_url is 4-6 times smaller than the uploaded ones and when I view in the GoogleAppEngine console, all those photos have same size as the uploaded ones. I don't know why GoogleAppEngine is not returning the actual sized images.
How can I put a python program with multiple files in /usr/local/bin?
30,831,720
0
0
494
0
python,shell,command-line
Put the python files in a folder and then put this folder into an installation directory (may be in /usr/local/foldername). Use chdir in script/s to change directory to the file containing folder (may be os.path.dirname(os.path.realpath(sys.argv[0]))) to import dependencies from there, or use absolute path. Now make a symbolic link of the executable file and put it in /usr/local/bin.
0
1
0
0
2015-06-14T01:25:00.000
1
1.2
true
30,825,162
1
0
0
1
I know that if my program were just one python script file, I could just start it with the shebang and put it in /usr/local/bin so that I could invoke it at any time from the command prompt. However, what if my program were multiple files, but I only want one to be invokable from the command line? For example, if I've got my_program.py and dependency.py, and my_program needs dependency, but I don't want dependency to be invokable? As I understand it, if I dump both in /usr/local/bin, then invoking either of their names will attempt to execute them... I only want my_program to be visible, but it also needs to be in the same dir as the dependency module. I know I could just copy/paste them into one single file but that feels wrong...
Can't install any python package from the python command prompt
30,833,498
0
1
4,366
0
python,shell,installation,package
Click Windows(button)+R then type cmd. In there type pip -V, what version does it show? If you get pip 6.1.1 from C:\Python32\lib\site-packages <python 3.4> (depending on your directory) then you're good, simply make your installations from there.
0
1
0
0
2015-06-14T19:11:00.000
3
0
false
30,833,432
1
0
0
2
I am trying to install some python packages from the python shell but I get syntaxError. I am using python 3.4.3 which supposed to come with pip installed and I can see pip3 pip3.4, pip, easy_install, and easy_install-3.4 under scripts but whenever I run the command in the shell I get syntax error. Am I not supposed to use the python shell for package installation? I am using windows 8.1 if that would explain something. I tried these commands: pip install packageName --- got syntaxError with this message:File '' line 1, pip install(with a mark at last l in install). easy_install packageName generated the same error message but with the mark at the last letter in the packagename, i double checked all spellings but I can't seem to see what the problem is. How can I install packages?
Can't install any python package from the python command prompt
30,833,440
3
1
4,366
0
python,shell,installation,package
Am I not supposed to use the python shell for package installation? No. Commands like pip are to be run on the operating system command line (i.e., the "DOS prompt" on Windows).
0
1
0
0
2015-06-14T19:11:00.000
3
0.197375
false
30,833,432
1
0
0
2
I am trying to install some python packages from the python shell but I get syntaxError. I am using python 3.4.3 which supposed to come with pip installed and I can see pip3 pip3.4, pip, easy_install, and easy_install-3.4 under scripts but whenever I run the command in the shell I get syntax error. Am I not supposed to use the python shell for package installation? I am using windows 8.1 if that would explain something. I tried these commands: pip install packageName --- got syntaxError with this message:File '' line 1, pip install(with a mark at last l in install). easy_install packageName generated the same error message but with the mark at the last letter in the packagename, i double checked all spellings but I can't seem to see what the problem is. How can I install packages?
Get environment variable for current user and for all users in Python
60,003,845
-2
6
4,434
0
python,environment-variables
you can get all the variables by import os print(os.environ) this will return you the dictionary type of output with keys as enviornment variables and values as the values of the enviornment variables. to get the current username: print(os.environ['USERNAME']) Look for yourself what you want in the dictionary.
0
1
0
0
2015-06-14T23:11:00.000
2
-0.197375
false
30,835,522
1
0
0
1
Is there way to determine which environment variables returned by os.environ belongs to current user and which one - to all users? I do not want to change it, only get. UPD: I am using Microsoft Windows 7.
How to execute script on schedule?
30,835,954
32
25
56,111
0
python,automation
You can use cron for this if you are on a Linux machine. Cron is a system daemon used to execute specific tasks at specific times. cron works on the principle of crontab, a text file with a list of commands to be run at specified times. It follows a specific format, which can is explained in detail in man 5 crontab Format for crontab Each of the sections is separated by a space, with the final section having one or more spaces in it. No spaces are allowed within Sections 1-5, only between them. Sections 1-5 are used to indicate when and how often you want the task to be executed. This is how a cron job is laid out: minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday), command 01 04 1 1 1 /usr/bin/somedirectory/somecommand The above example will run /usr/bin/somedirectory/somecommand at 4:01am on January 1st plus every Monday in January. An asterisk (*) can be used so that every instance (every hour, every weekday, every month, etc.) of a time period is used. Code: 01 04 * * * /usr/bin/somedirectory/somecommand The above example will run /usr/bin/somedirectory/somecommand at 4:01am on every day of every month. Comma-separated values can be used to run more than one instance of a particular command within a time period. Dash-separated values can be used to run a command continuously. Code: 01,31 04,05 1-15 1,6 * /usr/bin/somedirectory/somecommand The above example will run /usr/bin/somedirectory/somecommand at 01 and 31 past the hours of 4:00am and 5:00am on the 1st through the 15th of every January and June. The "/usr/bin/somedirectory/somecommand" text in the above examples indicates the task which will be run at the specified times. It is recommended that you use the full path to the desired commands as shown in the above examples. Enter which somecommand in the terminal to find the full path to somecommand. The crontab will begin running as soon as it is properly edited and saved. You may want to run a script some number of times per time unit. For example if you want to run it every 10 minutes use the following crontab entry (runs on minutes divisible by 10: 0, 10, 20, 30, etc.) */10 * * * * /usr/bin/somedirectory/somecommand which is also equivalent to the more cumbersome 0,10,20,30,40,50 * * * * /usr/bin/somedirectory/somecommand
0
1
0
0
2015-06-14T23:16:00.000
3
1.2
true
30,835,547
0
0
0
1
I have two Python scripts on my machine that I want to execute two times a day on specific time period. How do I automate this task? Since I will be away from home and thus my computer for a while, I want to upload them to a site and be executed from there automatic without me doing anything. How can I do this?
How to handle the File hand-off from windows in a python program
30,985,046
0
2
68
0
python,windows,pdf,file-io
So, yes, Windows passes the file name into the script as one of the sys.argvs. It is (so far as I can tell from printing the value) a file name without the path, that I used to open the file, so that tells me that Windows starts my program with the working directory set to the directory of the file it's called on. One word of caution, a gotcha of sorts, registering my .py as the default handler, did not work -- clicking on the file, resulted in Windows complaining that the file was not a valid windows executable. I didn't do any research but turned my .py into an .exe (py2exe) and registered that as the default file handler which did work. UPDATE, did not test it out but was told that specifying the python interpreter with my script as the default file handler would solve the "not valid" issue. Like this "C:\Python2.7\python.exe yourscript.py %*" the %* is to make so that the file name is made available to the script. (adding this without testing because on the one hand my problem has been solved and on the other what I was told makes sense to me)
0
1
0
0
2015-06-18T22:09:00.000
1
1.2
true
30,926,669
1
0
0
1
I want to set up my python program to process all pdfs that are opened on my system, and then hand the processed pdf off to a standard reader. So I register my program with windows as the default handler for .pdf files and windows presumably will run my program on the pdf file. How within the script do I access this file. Is the file name one the sys.argvs? I didn't get google to work for me here.
Changing a read-only file
30,939,390
6
0
253
0
python,text
Yes, you are right, you can only read where you cannot write.
0
1
0
1
2015-06-19T13:16:00.000
1
1.2
true
30,939,165
0
0
0
1
I need to change text documents. The way I've been doing it is making a new file, copying everything line by line from the old file and making changes on the way, then saving the new file as the old file's name. This becomes a problem when I only have read permission on the file. First I get OSErrno 30, not letting me delete the old file at the end of the writing. If I change my open command to 'r+', it simply says the file is not found. I don't have root access. Does anyone know of a workaround to this problem? EDIT: Thanks for the responses. I guess that IS the intended behavior of a read-only file...
For the life of me I cannot make a file-set argument the next to last one
30,944,299
1
0
52
0
python,filenames
It's your shell, not Python, that's doing the expansion. Python always sees a single flat list of arguments. In case you want to parse arguments, which basically turns this flat list into a more complex data structure, you can use the argparse module, or use more extensive third party projects like click.
0
1
0
0
2015-06-19T17:12:00.000
1
0.197375
false
30,943,690
1
0
0
1
I want to run something like: python command.py -i -c "f*.xxx" "search" This fine since "file-set" is not expanded" but: python command.py -i -c f*.xxx "search" This is expanded so sys.argv = ['command.py','-i', '-c', 'f1.xxx','f2.xxx','search'] Why couldn't it be ['command.py','-i', '-c', ['f1.xxx','f2.xxx'],'search'] ? Since the "f*.xxx" is not accessible I have no way to know if 'search' is a file name and the real 'search' missing. I want to print an error message that says "Please use quotes". And I must keep position this way and turning off globbing is not an option. getopt and argparse do not solve this. Thanks
Excuting cpp file from Python
30,954,837
2
0
70
0
python,c++
Look For python.net which is cable of making a call to the interfaces written in .net supported languages. What all you need to do is Steps: Download and put it two files Python.Runtime.dll and clr.pyd in your DLLs folder. From you >>>(triple greater than prompt )Python prompt Try >>>import clr if it doesn't gives any error you are good to go . Next You need to do is put Your C++ Dll inside Lib/site-packages Folder . (This is not mandatory but good for beginners). Next to import clr try importing your Dll as a module import YourDllName If step 5 doesn't gives you a error . Hola You are done That's All Folks :)
1
1
0
0
2015-06-20T13:36:00.000
2
0.197375
false
30,954,589
1
0
0
1
I need to execute C++ code to acquire images to process in python. I need to use these commands from python: make and ./name_of_the_executable Could anybody please help know me how to do it?
How can I read the dynamic section of an ELF file in python
31,053,673
1
1
1,452
0
python,linux,elf,readelf
using pyelftools: tag = section.get_tag(n) gives the nth tag of a specific section
0
1
0
0
2015-06-22T16:40:00.000
1
1.2
true
30,985,379
0
0
0
1
I want to get information about the dynamic section of an ELF file. Basically the same information I get using the command line: readelf -d elfFile
chef cookbook dependency on system software not on another cookbook
31,379,600
0
0
60
0
python,automation,chef-infra,orchestration
I applied the following steps to solve my problem Found the directory which gets created after installation of the independent software waited for the directory to get created(using ruby block code for sleeping) and initiated the installation of dependent software thereafter to ensure the dependency is satisfied. solved my issue..
0
1
0
0
2015-06-23T08:42:00.000
2
1.2
true
30,997,900
0
0
0
1
As part of a platform setup orchestration we are using our python package to install various software packages on a cluster of machines in cloud. We have the following scenario: Our python package initiates installation of certain software packages(say A,B,C) then simultaneously initiates installation of certain other (say D,E,F). (N.B:. D,E,F are through our chef cookbooks and A,B,C are through our python programs ) Our problem is that software D(installs through chef cookbook) depends on software A. Since, D depends on A, cookbook for D does not find A in system and fails. What I was thinking was, if we can have a dependency in chef cookbook saying that proceed only if A is found in system else wait! Is it possible? are there any alternatives to above problem? Thanks
GAE golang templates stopped working
31,039,704
0
0
50
0
python-2.7,google-app-engine,go
I re-installed Python (the module_test and other tests failed) and updated the gae-go sdk. This fixed my problem. I believe that a recently identified Flash exploit had something to do with it as I experienced a number of Flash crashes in web page ads just before the problems began.
0
1
0
0
2015-06-23T16:46:00.000
1
0
false
31,008,719
0
0
1
1
I've been successfully using go for months - last night my app started 404 page not found errors but only on pages that use Templates. Those that don't use the Template system work fine. I re-installed the Go sdk and discovered that the Guestbook demo ( also uses Templates) doesn't work either. ... and then I noticed that links to the log files weren't appearing on the Instance page of the dev console - but when I click the "default" link it displayed the guestbook templated page that I had just requested and got the 404. It seems that the system can't find template folder and that is causing the 404s My configuration seems to have broken and I haven't been able to figure out why - hope someone can help... ...After messing with environment variables and stuff for a while with no success, I ran "test_Python" file. These all generated Errors: test_too_big_rewrite, module_test, python_sandbox_test all generated errors - the process hung up on "test_serve" This is causing my problems? Is there a way to correct? Uninstall and reinstall Python? Will I have to uninstall/reinstall Go SDK ? thanks!
Typing 'python' in terminal runs a python script and spits error
31,015,074
0
0
64
0
python,python-2.7
Thanks, @JoranBeasley, @barunsthakur, @PadraicCunningham, and all. I had PYTHONSTARTUP set in .bashrc. May help forgetful people in the future.
0
1
0
1
2015-06-23T22:57:00.000
3
0
false
31,014,858
1
0
0
2
I'm taking a python course, I save exercise scripts in /this/is/where/I save/exercises/exercise.py. Now whenever I type python in terminal it immediately gives me this: IOError: [Errno 2] No such file or directory: '/this/is/where/I save/exercises/exercise.py' I know it's not found since I deleted the file. But why is python running that script whenever it runs? It's annoying. INFO Linux OS Python2 and Python3 both show same error
Typing 'python' in terminal runs a python script and spits error
31,014,929
-1
0
64
0
python,python-2.7
Python has a special script that is run on startup. On my platform it is located at /usr/lib/python2.5/site-packages/sitecustomize.py IIRC. You may want to check that file for any script calls to that directory. Also, if you are on a linux machine you could check /etc/bashrc or /etc/profile.d. If that doesn't help, try to update your question with more specific information.
0
1
0
1
2015-06-23T22:57:00.000
3
-0.066568
false
31,014,858
1
0
0
2
I'm taking a python course, I save exercise scripts in /this/is/where/I save/exercises/exercise.py. Now whenever I type python in terminal it immediately gives me this: IOError: [Errno 2] No such file or directory: '/this/is/where/I save/exercises/exercise.py' I know it's not found since I deleted the file. But why is python running that script whenever it runs? It's annoying. INFO Linux OS Python2 and Python3 both show same error
Recover Python script from memory, I screwed up
31,015,993
7
5
17,971
0
python,recovery
As far as I know, Python doesn't keep the source in memory, and the method presented in the comment only keeps executables alive, not scripts. Dumping the memory of the program probably allows you to get to the bytecode, but I have no idea how much effort that might require. Instead, I'd first try a non-Python-specific approach that I've succesfully used to recover Python sources that I've accidentally deleted. This assumes the filesystem is ext2/3/4 and that you have root access. The first step (in any recovery) is obviously to try to avoid writing any files on the system so as to not overwrite the data that you are looking for. On a home system I'd probably personally remount the partition as read-only if possible to avoid any more writes going through. I've heard other people recommend just quickly pulling the plug, which might prevent the OS/disk cache from being written to the disk and perhaps save you some additional data (or even prevent the deletion) if you're really quick about it. On a remote system, neither of these is probably a good idea (unless the data is really important and you can get the disk shipped to you or something) since the system might not like it if something goes read-only all of a sudden. The second step is to execute debugfs /dev/sdXY, where /dev/sdXY is the partition that the deleted file was on. In the prompt, say blocks /path/to/the/directory/the/removed/file/was/in. Then, give the blocks command paths to other existing files in the directory. Now, exit the program by saying quit, and hope that the block numbers you saw were close to each other. If the directory is old and the block numbers scattered, start with a recent file's block numbers. (That is, one that has been last modified as close in time to the removed file's last modification time as possible) We will try to scan the contents of the partition near the other files in the directory under the assumption that the files was stored close to them. Execute dd if=/dev/sdXY bs=4096 skip=BLOCKNUMBER count=COUNT |grep -C APPROXIMATE_LINE_COUNT_OF_THE_REMOVED_FILE WORD, where BLOCKNUMBER is a number somewhere before the first block number, COUNT is some suitable number of blocks to search and WORD is a word that was contained in the source file. If you don't get anything, try fishing near another file's blocks. If time is not an issue, and you can think of a string that only occurred in the removed file (so you don't get too many false positives), you might just skip all that and scan the whole disk with grep -a WORD -C LINECOUNT /dev/sdXY. Another method (that you should try before the other one) that probably won't work for you since IIRC recent versions of Ubuntu (and probably other systems too) by default configure the kernel to block access to /dev/mem, is trying to scan the memory for the file. Just do grep -a WORD -C LINECOUNT /dev/mem to scan memory instead of the partition. (This can also save your day if you've written a long text in a form field and you misclick and your browser empties the field)
0
1
0
1
2015-06-24T00:13:00.000
3
1.2
true
31,015,556
0
0
0
1
Help, I screwed up. I have a somewhat complex python script that is currently running in a putty window to a Ubuntu server. I accidentally overwrote the script using another putty window, so the copy on the hard drive is now gone, but the script is still running from memory in the first window. This happened before I had a chance to run my backups for this folder. Is there a way I can get the script, (that is currently running) from the memory in the first putty window? I haven't stopped the script, my guess is once I stop it it will be gone forever. Can I send it to a background process somehow (some hot key,) then glean the script from a memory dump or something. I assume something like this would have to happen from the actual window from which the script is running. It would be nice if I could get the .py back, I heard Python compiles the script before running, if that is the case, the human readable part may be gone. Sigh, it has been a stressful day. Thanks for any help, Mark.using
Python pip install error
36,225,388
0
0
1,929
0
python,macos,python-2.7,python-3.x
I have similar issue with pip install. However, if I do "sudo su -" then do my pip install 'fileName', that solve the problem for me.
0
1
0
0
2015-06-24T03:16:00.000
2
0
false
31,017,006
1
0
0
1
I have just installed Python 3.4.3 on my MAC (Yosemite). I need to install a couple of lxml, however everytime I type in: pip install /""/, I get error messages. I have followed multiple tutorials and pip is installed. MAC already had Python 2.7., but I installed the 3.4.3. version, not sure if that is the issue. The error message is: Brunos-MacBook-Pro:~ BrunoPaesLeme$ pip install /Macintosh HD/Users//Downloads/pycairo-1.10.0-cp27-none-win_amd64.whl Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/basecommand.py", line 223, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/commands/install.py", line 268, in run wheel_cache File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/basecommand.py", line 268, in populate_requirement_set wheel_cache=wheel_cache File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/req/req_install.py", line 207, in from_line wheel_cache=wheel_cache) File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/req/req_install.py", line 66, in init req = pkg_resources.Requirement.parse(req) File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/_vendor/pkg_resources/init.py", line 2960, in parse reqs = list(parse_requirements(s)) File "/Library/Python/2.7/site-packages/pip-7.0.3-py2.7.egg/pip/_vendor/pkg_resources/init.py", line 2891, in parse_requirements raise ValueError("Missing distribution spec", line) ValueError: ('Missing distribution spec', '/Macintosh') Anybody knows what I could be doing wrong? Any help would be appreciated.
Crontab, python script fails to run
31,025,417
4
1
1,804
0
python,bash,unix,crontab
The working directory of the cron is different from the directory you run the script directly. Make your bash script to use absolute path for python script files. Or make the bash script to change directory to where you run the script directly.
0
1
0
1
2015-06-24T11:31:00.000
2
1.2
true
31,025,392
0
0
0
1
I have a bash script to automate few things I do. The bash calls 2 python scripts, If I run the bash script normally, everything runs, no errors what so ever. I set up a cron job to Automate this and when I checked the logs I noticed the python scripts don't run at all. It gives me the following error. python: can't open file 'movefiles.py': [Errno 2] No such file or directory python: can't open file 'create_log_shimmer.py': [Errno 2] No such file or directory Both these files exist and runs when calling the bash script directly.
python script via windows 7 scheduler still running
31,075,460
0
1
627
0
python,windows-7,scheduled-tasks
While I had the Task Scheduler open, the screen was showing "running". After I closed the screen and let it run the next day, everything worked fine. It must be something to do with the refresh on the task scheduler. So my solution was to close the Task Scheduler and let it run as scheduled.
0
1
0
0
2015-06-25T19:52:00.000
1
0
false
31,059,562
0
0
0
1
I'm a noobie to python and have over the past few days tested and created a .PY file that runs perfectly from the command prompt either with the D:\Python34 or just as Its pretty basic. Gets info from web and places it in a spreadsheet - I import requests, BeautifulSoup and openpyxl. The last statement is to save the workbook. I'm figuring that Python closes itself as does the workbook. I wish to run it daily. So I used the Windows Task Scheduler on my Windows 7 Ultimate. I have it running only when I am logged in. I have tried the following: 1) using python directly with complete paths 2) using only the full path and the 3) using a batch file that does #1 above and has an EXIT 4) using a batch file that does #2 above and has an EXIT When running the batch from the command file OR Task Scheduler, the command window opens, it does its thing and the command window closes. The problem is when I run it via the Task Scheduler in any of the above ways, it does its thing, but continues to say "RUNNING" in the scheduler. I have tried to run the Windows Process Monitor using some filters I found on the web, however nothing shows up. Extremely frustrating --Any suggestions would be appreciated. Jerry
Processing data from Google App Engine on a Google Virtual Machine
31,260,767
0
1
47
0
python,google-app-engine,virtual-machine,google-cloud-platform
Sticking with the described POST request using urllib2. We decided we might move this part of the project to a different provider so better to not use Google Cloud only methods.
0
1
0
0
2015-06-26T08:23:00.000
1
1.2
true
31,068,381
0
0
1
1
My website runs on Python on Google App Engine, and I've setup a Virtual Machine to use libraries that weren't supported by the default App Engine environment. Now I need to send data from my app to the VM and retrieve the response. Data in this case will be an email address and an email message. Currently I am testing with a POST request through urllib2. Is there a better way to do this?
Run script bash on saltstack master before minion
31,254,893
0
0
905
0
python,git,salt-stack
If you need the highstate on the minion to cause something to occur on the master than you are going to want too look into using salt's Reactor (which is designed to do exactly this kind of multi-machine stuff).
0
1
0
1
2015-06-26T13:07:00.000
3
1.2
true
31,073,993
0
0
0
2
I allow myself to write to you, due to a block on my part at Salt. I made a bash script that adds a host in my zabbix monitoring server. it works perfectly when I run .sh the idea is that I want to automate this configuration through salt. I am when I do a highstate my state that contains the script runs in the master before minion because there's my login authentication in my bash script. Is there's a special configuration for its? is what you have ideas how to do like this kind of setup? according to my research I found that to be used as the salt-runner but I do not know if this is good or not; In anticipation of your return, I wish you a good weekend.
Run script bash on saltstack master before minion
31,083,687
0
0
905
0
python,git,salt-stack
Run a minion on the same box as your master, then you can run the script on your master's minion and then on the other server.
0
1
0
1
2015-06-26T13:07:00.000
3
0
false
31,073,993
0
0
0
2
I allow myself to write to you, due to a block on my part at Salt. I made a bash script that adds a host in my zabbix monitoring server. it works perfectly when I run .sh the idea is that I want to automate this configuration through salt. I am when I do a highstate my state that contains the script runs in the master before minion because there's my login authentication in my bash script. Is there's a special configuration for its? is what you have ideas how to do like this kind of setup? according to my research I found that to be used as the salt-runner but I do not know if this is good or not; In anticipation of your return, I wish you a good weekend.
Including Fake-headers via pycparser in Windows?
31,080,381
2
1
261
0
python,windows,pycparser
The documentation is one and the same. You cannot effectively use pycparser without a basic understanding of how the C compilation pipeline works - sorry! The documentation actually addresses Windows directly. The only difference is that instead of relying on a system C compiler (on Linux) you have to explicitly download one for Windows - and the documentation even gives you a link. Once you download Clang for Windows, which gives you preprocessing on Windows, everything else is platform-agnostic.
0
1
0
0
2015-06-26T13:22:00.000
1
1.2
true
31,074,329
1
0
0
1
We can support new typedefs , #includes and #defines , by preprocessing it with the help of pycparser parse_file . I also went through the documentation: README page and the blog post , but all the documentation was written for linux systems.I have no clue about linux systems and would love to get the documentation for windows.
Why haven't I got "Scripts" in Python27 on Windows?
31,088,517
1
1
1,848
0
python-2.7,pip
I have solved my problem: When I have tried to run get-pip, I have right-clicked on the file get-pip.py and I have chosen "Python Launcher for Windows" to run it. Instead, I should have opened the command prompt in the right folder and I should have written "python get-pip.py".
0
1
0
0
2015-06-26T14:30:00.000
1
1.2
true
31,075,818
1
0
0
1
I have installed Python2.7 on Windows. I tried to install pip, so I downloaded get-pip, then I run it but it didn't install anything in "scripts" in python27, neither in Python27/Tools/Scripts
Make an batch file that runs commando in WinPython Command Prompt
31,158,200
1
4
4,820
0
windows,batch-file,python-3.x
I solved the problem by removing the path from normal python installation. I also uninstalled the normal python distribution. I also made a path to the python version in WinPython. Now I can use the normal cmd to run the program. :-)
0
1
0
0
2015-06-29T10:17:00.000
2
1.2
true
31,113,114
1
0
0
1
How do I write an batch file that will execute a commando "python my_program.py" from the WinPython Command Prompt? Not from the cmd.exe!
How to tell if windows processes have started
31,119,681
0
1
34
0
python,windows
The solution I came up with uses two batch files. One to run Load with an argument of 105 that is in the startup folder and the other batch file will be put on the desktop with a time of 45. Not my favorite solution, but it gets the job done and it's fairly easy to understand.
0
1
0
0
2015-06-29T14:22:00.000
1
0
false
31,118,164
0
0
0
1
I wrote a program called load, to show a loading bar for 0:45 seconds while another program is starting which has no indication that it is loading. It works exactly as I want when the system is already running, but I have it so it runs at startup which causes the program to take a 1:45 to start. I am trying to figure out a way to check if it is a fresh system start. I don't have any code yet since I don't know where to start. The only solutions I've thought of are just making a load1 and load2 where load1 has a loading bar of 1:45 that is run at startup and load2 is 0:45. My other idea is trying to schedule a task if that is possible. The only problem with that is that it would display nothing for 1:00 which kind of defeats the purpose. I don't really like either of these solutions. Another possibility that would work is if I can check if I am calling it from the desktop or the startup folder. I'm having no luck with that though.
Installer script for OSX, python + node
31,131,268
0
0
35
0
python,macos,bash,installation
Are you using python2 or python3? Dependencies for scapy differ.
0
1
0
0
2015-06-29T20:36:00.000
1
0
false
31,125,113
1
0
0
1
I'm writing what is a relatively small desktop application, but I'm using several technologies/languages and not sure the best way to create a installer script. I have a python script which uses tornado and scapy (which also requires pcapy), and have a kernel extension that needs to be installed. This python script is executed and works in conjunction with a node-webkit (nw) app I'm writing. Any suggestions on the easiest way to ensure all of the dependencies are met, and properly installed without the user having to touch the command line? Using python setuptools or pyinstaller? Package it together with nw? Use OS X packagemaker? Writing a bash script? Should I distribute these dependancies with my actual app?
Remove 1 version of Python in Ubuntu
31,129,540
-3
2
2,398
0
python,python-2.7,ubuntu,tkinter,versions
You can delete the whole /usr/local directory and the system won't be affected because /usr/local is the directory defined by the user solely. When you freshly install Ubuntu /usr/local is empty
0
1
0
0
2015-06-30T03:02:00.000
3
-0.197375
false
31,128,840
1
0
0
1
So apparently I have 2 Pythons (same version) installed in different folders...one is in /usr/bin/ and the other one is in /usr/local/bin but the one the shell uses when I type in python is the one in /usr/local/bin. I'd like to use the /usr/bin/ version because is the one that works with many imports I've been dealing with such as numpy,matplotlib and Tkinter. I've tried using pyenv but with this I cannot run Tkinter because Tkinter is installed only for the /usr/bin/ version. Is there a safe way I can delete/uninstall one of those versions without breaking my whole Ubuntu? Is there a way to tell the shell to use the /usr/bin/ version of Python? Is there a way I can install python-tk for any envpy version? Something like sudo apt-get install python-tk in-desired-folders or similar? Answer for any of those 3 questions would solve my problem, I think. Thank you all in advice!
Run a Python program at start-up on Windows
33,310,327
1
2
11,230
0
python,windows,python-2.7,executable
Use VBScript: 1-> create anyname.vbs with this data: Set wvbs=CreateObject("Wscript.Shell") wvbs.run "full location of your File",0 2-> copy anyname.vbs file in C:\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup this folder Now when windows start it will run your file in hidden mode
0
1
0
0
2015-06-30T06:18:00.000
4
0.049958
false
31,130,960
1
0
0
1
I am developing a key-logger on Python (only for curiosity sake). And the script will be an executable. Without access to the computer so the process should not need a UI or user interaction. Is there any way, even in another executable to make the key-logger start at start-up ?
Neo4j from Python in Windows 7
31,165,664
1
0
340
0
python,windows,neo4j
py2Neo is a library which you can generate/configure/manipulate Neo4j graph database. It is not an executable application. As far as your Python works on Windows, py2neo should work as well. You can download py2neo via pip install as you can download many libraries as well.
0
1
0
0
2015-07-01T15:13:00.000
1
0.197375
false
31,165,248
1
0
0
1
I would like to use Neo4j from Python in Windows 7 operating system. Which library can I install? Py2Neo seems to work for Linux and Mac but not for Windows.
Block output window from an executable converted from .pyw using pyinstaller
31,180,100
0
0
135
0
python
Oh nevermind, i already know how. By using --noconsole when converting the .pyw I think it works with .py extension too Sorry for bad english..
0
1
0
0
2015-07-02T08:57:00.000
1
0
false
31,179,989
1
0
0
1
I recently converted a python program to an executable (.exe) but i still see an output window when i launched the executable. I don't want any output window because the program is a background process. I tried using .pyw extension before converting to an executable with no success... I'm using pyinstaller to convert to executables.
How to switch between python2 and python3 pip on Fedora 22?
42,448,451
0
2
3,457
0
python,python-2.7,pip,fedora,python-3.4
on fedora 25 you can just do the following: copy file sudo cp /usr/bin/pip /usr/bin/pip3 then edit it to change #!/usr/bin/python to #!/usr/bin/python3 do pip3 -V to see that works. this solution can also work on others version of fedora.
0
1
0
0
2015-07-02T10:54:00.000
4
0
false
31,182,595
1
0
0
3
As I have started to use Python 3.4, I need pip to maintain libraries on both Python 2.7 and Python 3.4. How to select the appropriate pip quickly using terminal? Note: This question is NOT related to Virtualenv but with the default python2.7 and python3.4 that comes with Fedora 22 Workstation. As a temporary fix, I am using PyCharm to manage libraries.
How to switch between python2 and python3 pip on Fedora 22?
32,880,093
3
2
3,457
0
python,python-2.7,pip,fedora,python-3.4
I never use pip install directly (when outside a venv, at least). Instead I use python-<version> -m pip install --user <packages>, which always does what I really meant regardless of what version the wrapper scripts are for. This is especially useful if I've locally installed a newer version of pip.
0
1
0
0
2015-07-02T10:54:00.000
4
0.148885
false
31,182,595
1
0
0
3
As I have started to use Python 3.4, I need pip to maintain libraries on both Python 2.7 and Python 3.4. How to select the appropriate pip quickly using terminal? Note: This question is NOT related to Virtualenv but with the default python2.7 and python3.4 that comes with Fedora 22 Workstation. As a temporary fix, I am using PyCharm to manage libraries.
How to switch between python2 and python3 pip on Fedora 22?
31,182,728
2
2
3,457
0
python,python-2.7,pip,fedora,python-3.4
Fedora separates Python 2.x and 3.x's environments. yum install python-pip will give you an executable called pip which you can use for Python 2.x packages, and yum install python3-pip will give you an executable called pip3for managing Python 3.x packages. You can install either, both or neither - they will not interfere with each other.
0
1
0
0
2015-07-02T10:54:00.000
4
1.2
true
31,182,595
1
0
0
3
As I have started to use Python 3.4, I need pip to maintain libraries on both Python 2.7 and Python 3.4. How to select the appropriate pip quickly using terminal? Note: This question is NOT related to Virtualenv but with the default python2.7 and python3.4 that comes with Fedora 22 Workstation. As a temporary fix, I am using PyCharm to manage libraries.