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
Python 2.7.2 install on Suse Linux Server 11.3 can't find tkinter dependencies
8,662,523
0
0
1,235
0
python,build,suse
I found many distribution points for sets of rpm packages. This enabled me to install individual packages such as the headers for tcl. But, this was a bad approach because the full dependency hierarchy to build Python support for tkinter is something on the order of 60 packages. I found that the OpenSuSE repository for version 11.3 of the OS contained everything I needed. My Novell distro came with Novell's repositories which exclude nearly all devel packages. Problem solved. The make of python found all of the prerequisites for tkinter. Sorry to post such a nube question.
1
1
0
0
2011-12-27T22:48:00.000
1
1.2
true
8,650,079
0
0
0
1
I've spent hours on this. Seems like our job on Linux is to debug scripts that don't work across the fragmented distros rather than getting work done. Setup.py tries to find what it needs and build the c modules used to wrap certain dependencies if it can find what it needs. This makes the script super fragile relative to paths and file names. While it is VERY hard to tell from the .py source, it seems for tkinter we need tcl, tk, and tix. Latest versions of these are all installed. I can verify this because Python 2.6 that comes with the SUSE distro imports_tkinter and Tkinter modules and runs the test script correctly. The script seems to need to find the libraries. I have both 32 bit and 64 bit installed. So, these libraries exist: 32bit 64bit libtk8.5.so /usr/lib /usr/lib64 libtcl8.5.so " " Both paths are included in the appropriate search list in Setup.py. But, I don't think Setup.py searches for the correct file names. It seems to search for files that begin with tk and tcl, catenating a variety of different versions (including '8.5'). But, the file names don't begin with 'lib'. Before I begin tampering more, could the Python.org folks have really messed this up so badly? That doesn't seem likely. Is SUSE Linux so odd a distro? This doesn't seem likely either. I don't think setup.py would look for the binaries (would matter at run time it would seem...) but they are present in usr/lib and usr/lib64. The only include file I can find is for tclextend. It is tclextend.h found in usr/include. I could not find other .h files for tcl or tk. Of course the include files that the Python c wrappers require are supplied with the download of Python 2.7. So, I am kind of at my wit's end. This is such a colossal waste of time. Is there a way to just skip the build process and just build the tcl/tk support? I also have the same problem with ssl: it would not build. One thing at a time. Thanks for your help.
random: not enough state (1 bytes); ignored
9,056,422
2
2
403
0
python,linux,macos
eaj is correct that initstate needs more than 8 bytes for state information. The best way to do this for ghmm is with either the --enable-gsl or --with-rng=bsd option for ./configure. --with-rng=bsd makes the type "ghmm_rng_state_t" 8 bytes instead of 1. See rng.h in the ghmm directory.
0
1
0
1
2011-12-28T17:05:00.000
3
0.132549
false
8,658,934
0
0
0
1
Not sure what the above error means. I just installed ghmm on my mac and get this error every time I do a import ghmm. I do not get this message on my ghmm install on my linux machine and other than that all functions appear to be fine. I wondering if anyone has seen this before and if there's anything I can do to get rid of this. The only thing I did different between the two installs was the autogen.sh file was refering to "libtoolize" which doesn't exist on my mac so I changed it to its replacement "glibtoolize" which allowed it to compile and install fine. Any suggestions on what this error actually means(and hopefully how I can solve it) would be great. (I couldn't find the answer on google but this program does not appear to be specific to ghmm)
Run a python script in perl
8,659,430
1
3
11,721
0
python,perl
It may be simpler to run both scripts from a shell script, and use pipes (assuming that you're in a Unix environment) if you need to pass the results from one program to the other
0
1
0
1
2011-12-28T17:34:00.000
3
0.066568
false
8,659,226
1
0
0
1
I have two scripts, a python script and a perl script. How can I make the perl script run the python script and then runs itself?
Is there any way to access Protocol Buffers with python 3.x?
26,048,683
6
26
14,100
0
python,python-3.x,protocol-buffers
The latest version of Google Protocol Buffers (2.6) added Python 3 support. I suggest using that. EDIT: Nevermind. They lied in their release notes.
0
1
1
0
2011-12-29T02:43:00.000
6
1
false
8,663,468
0
0
0
2
We use Python 3.x in our projects. But the official client of Protocol Buffers only supports python 2.x. I don't want to downgrade to python 2.x.
Is there any way to access Protocol Buffers with python 3.x?
50,994,740
1
26
14,100
0
python,python-3.x,protocol-buffers
Google's official library has supported Python 3 since version 3.0 (Jul 29, 2016).
0
1
1
0
2011-12-29T02:43:00.000
6
0.033321
false
8,663,468
0
0
0
2
We use Python 3.x in our projects. But the official client of Protocol Buffers only supports python 2.x. I don't want to downgrade to python 2.x.
How can I implement a POSIX file descriptor in Python 3?
8,684,222
2
5
1,279
0
python,file-io,python-3.x,posix,file-descriptor
You can't. POSIX file descriptors are tracked in the operating system kernel, outside the world of Python; you can't simulate them in Python code.
0
1
0
0
2011-12-30T21:04:00.000
3
0.132549
false
8,684,091
0
0
0
1
I'd like to write a class that can behave as a bona fide file descriptor. Its .fileno() method should return a file descriptor that provides all the services a POSIX system expects. This is my first foray into POSIX system programming, so I could be misunderstanding things quite badly. The underlying motivation is the desire to use an in-memory Python object as the stdin or stdout kwarg to the subprocess.Popen constructor without having to rely on temporary or memory-mapped files. But I'm not interested in some clever trick that would get the job done -- I really want to have a Python implementation capable of answering all the relevant system calls.
How do I run long term (infinite) Python processes?
8,685,801
2
38
36,296
0
python,apache,daemon,infinite-loop
I assume you are running Unix/Linux but you don't really say. I have no direct advice on your issue. So I don't expect to be the "right" answer to this question. But there is something to explore here. First, if your daemons are crashing, you should fix that. Only programs with bugs should crash. Perhaps you should launch them under a debugger and see what happens when they crash (if that's possible). Do you have any trace logging in these processes? If not, add them. That might help diagnose your crash. Second, are your daemons providing services (opening pipes and waiting for requests) or are they performing periodic cleanup? If they are periodic cleanup processes you should use cron to launch them periodically rather then have them run in an infinite loop. Cron processes should be preferred over daemon processes. Similarly, if they are services that open ports and service requests, have you considered making them work with INETD? Again, a single daemon (inetd) should be preferred to a bunch of daemon processes. Third, saving a PID in a file is not very effective, as you've discovered. Perhaps a shared IPC, like a semaphore, would work better. I don't have any details here though. Fourth, sometimes I need stuff to run in the context of the website. I use a cron process that calls wget with a maintenance URL. You set a special cookie and include the cookie info in with wget command line. If the special cookie doesn't exist, return 403 rather than performing the maintenance process. The other benefit here is login to the database and other environmental concerns of avoided since the code that serves normal web pages are serving the maintenance process. Hope that gives you ideas. I think avoiding daemons if you can is the best place to start. If you can run your python within mod_wsgi that saves you having to support multiple "environments". Debugging a process that fails after running for days at a time is just brutal.
0
1
0
1
2011-12-31T01:39:00.000
3
0.132549
false
8,685,695
0
0
0
1
I've recently started experimenting with using Python for web development. So far I've had some success using Apache with mod_wsgi and the Django web framework for Python 2.7. However I have run into some issues with having processes constantly running, updating information and such. I have written a script I call "daemonManager.py" that can start and stop all or individual python update loops (Should I call them Daemons?). It does that by forking, then loading the module for the specific functions it should run and starting an infinite loop. It saves a PID file in /var/run to keep track of the process. So far so good. The problems I've encountered are: Now and then one of the processes will just quit. I check ps in the morning and the process is just gone. No errors were logged (I'm using the logging module), and I'm covering every exception I can think of and logging them. Also I don't think these quitting processes has anything to do with my code, because all my processes run completely different code and exit at pretty similar intervals. I could be wrong of course. Is it normal for Python processes to just die after they've run for days/weeks? How should I tackle this problem? Should I write another daemon that periodically checks if the other daemons are still running? What if that daemon stops? I'm at a loss on how to handle this. How can I programmatically know if a process is still running or not? I'm saving the PID files in /var/run and checking if the PID file is there to determine whether or not the process is running. But if the process just dies of unexpected causes, the PID file will remain. I therefore have to delete these files every time a process crashes (a couple of times per week), which sort of defeats the purpose. I guess I could check if a process is running at the PID in the file, but what if another process has started and was assigned the PID of the dead process? My daemon would think that the process is running fine even if it's long dead. Again I'm at a loss just how to deal with this. Any useful answer on how to best run infinite Python processes, hopefully also shedding some light on the above problems, I will accept I'm using Apache 2.2.14 on an Ubuntu machine. My Python version is 2.7.2
tornado.web : Is there a method which is called after the actual handler method?
9,072,583
3
1
922
0
python,tornado
Starting Tornado 2.2 now you can override RequestHandler.on_finish for post-request processing.
0
1
0
0
2011-12-31T06:28:00.000
2
1.2
true
8,686,745
0
0
1
1
Tornado web framework seems to expose a method RequestHandler.prepare() which is called before the actual handler method. I was wondering if there's a similar method which is called after the handler ?
Open specific file type with Python script?
8,694,464
-1
12
5,722
0
python,default,file-association
Find any file of type foo right-click -> Get Info or Click on the file icon,then click Get info or click on the file and hit Command+I In the Open With pane that shows up, select the path to the python binary Once selected, You can click the change All button It'll ask for confirmation, just say continue
0
1
0
0
2012-01-01T14:45:00.000
5
-0.039979
false
8,693,622
1
0
0
1
How can I make a Python script to be a specific file type's (e.g., *.foo) default application? As in, when I double click the file in the Finder / Explorer I want the file to open in the Python script. Is this possible to do in Win and/or OS X? The application is a PySide app if that matters.
Should I use Python or Ruby for creating a cross-platform, compiled application?
8,716,554
0
3
1,058
0
python,ruby,compilation,distribution
Use whatever language you know well, I know python and use that to develop windows desktop applications and end user can't distinguish it with say a C# or C++ app
0
1
0
1
2012-01-03T02:16:00.000
2
0
false
8,707,238
0
0
0
1
I'm a fan of Ruby but I don't oppose Python. ( I have 2+ years of Ruby experience and maybe 2 months of Python ). Anyway, I need to create a service for both the Mac and Windows (and Linux, actually) that takes certain files from different directories and sends them to S3. I could use .NET on Windows but I don't want to use Objective-C and I would love to keep my code-base the same on all platforms. So after digging around a little, it looks like I should be able to compile either Ruby or Python to byte-code and distribute an interpreter to run the code. But, am I wrong in assuming that Python has better support for compiling code? As in .pyc byte code? Also, I would prefer the end user not be able to read my source code but I'm not going to the end of the world to try and stop them. Thanks!
how to copy an executable file with python?
8,709,784
0
0
2,980
0
python,executable
Use shutil.copyfile(src, dst) or shutil.copy(src, dst). It may not work in case of files in the C:\Program Files\ as they are protected by administrator rights by default.
0
1
0
1
2012-01-03T03:42:00.000
5
0
false
8,707,663
1
0
0
2
How can i copy a .exe file through python? I tried to read the file and then write the contents to another but everytime i try to open the file it say ioerror is directory. Any input is appreciated. EDIT: ok i've read through the comments and i'll edit my code and see what happens. If i still get an error i'll post my code.
how to copy an executable file with python?
8,707,865
1
0
2,980
0
python,executable
Windows Vista and 7 will restrict your access to files installed into the Programs directories. Unless you run with UAC privileges you will never be able to open them. I hope I'm interpreting your error properly. In the future it is best to copy and paste the actual error message into your question.
0
1
0
1
2012-01-03T03:42:00.000
5
0.039979
false
8,707,663
1
0
0
2
How can i copy a .exe file through python? I tried to read the file and then write the contents to another but everytime i try to open the file it say ioerror is directory. Any input is appreciated. EDIT: ok i've read through the comments and i'll edit my code and see what happens. If i still get an error i'll post my code.
Formatting a single row as CSV
8,711,375
3
0
464
0
python,csv
The csv module wraps the _csv module, which is written in C. You could grab the source for it and modify it to not require the file-like object, but poking around in the module, I don't see any clear way to do it without recompiling.
0
1
0
0
2012-01-03T10:52:00.000
2
1.2
true
8,711,147
0
1
0
1
I'm creating a script to convert a whole lot of data into CSV format. It runs on Google AppEngine using the mapreduce API, which is only relevant in that it means each row of data is formatted and output separately, in a callback function. I want to take advantage of the logic that already exists in the csv module to convert my data into the correct format, but because the CSV writer expects a file-like object, I'm having to instantiate a StringIO for each row, write the row to the object, then return the content of the object, each time. This seems silly, and I'm wondering if there is any way to access the internal CSV formatting logic of the csv module without the writing part.
Net-SNMP returns HexString and then just String (Eclipse and Pydev)
8,731,472
0
0
737
0
python,eclipse,pydev,net-snmp
PyDev does one thing differently, which is setting: sys.setdefaultencoding(encoding) with the encoding of the java console (so that if you print unicode to the console it won't fail saying that the unicode doesn't decode as ascii). To see if this is your problem, you can go to eclipse\plugins\org.python.pydev\PySrc\pydev_sitecustomize\sitecustomize.py and comment the line which does: sys.setdefaultencoding(encoding)
0
1
0
0
2012-01-03T15:04:00.000
1
1.2
true
8,714,233
0
0
0
1
I am doing an snmpget using Net-SNMP. Specifically I am sending a command via os.popen("etc"). The value returned is a Hex-string separated by spaces, something like this : "A0 f0 D0". The returned value comes sometimes in the form :"Hex-String: A0 f0 D0.." but sometimes comes in the form "String:\xA0\xf0\xD0" where, as you can see, the spaces are filled with "\x". Does anyone have an idea as to why this might be happening? I would prefer it if the returned value was the HEX-String with spaces, not \x. I should note that I am using Eclipse with Pydev. I then ran the same code in pyscripter and got back my Hex-String value. I ran it again in Pyscripter and then the \x's returned. Is this something to do with an unclosed pipe? I should also mention that the data I am getting back is bad in another sense. The Hex-String with spaces returns proper data values, but the String with \xs returns values that are not correct. I have used Wireshark and it looks like the get request is exactly the same as one sent from the MIB. The MIB request returns the correct data, while the Eclipse request still returns bad data.
How do you compile Python C/C++ extensions for different OS/versions of Python?
10,105,281
0
8
2,222
0
python,cross-platform,packaging,python-c-extension
All of my Python extension modules are C++, not C so I use boost Python. I also use virtual machines when I need to support different operating systems. Boost's bjam build driver allows you to build with different versions of Python (2.6, 2.7) different versions of g++ and various other things. If I had an extension module that was very popular and many people wanted to use it on platforms that I do not have, then I would just make sure my code was very portable (it should be anyway) and provide instructions on how I build it with bjam using several different examples for different Python versions, etc. That would be enough to get them started. If this works, you could ask them to contribute their builds back so others could use them (unsupported by you of course).
0
1
0
0
2012-01-04T04:11:00.000
3
0
false
8,721,918
1
0
0
2
I have noticed that several mature Python libraries have precompiled versions for most architectures (Win32/Win-amd64/MacOS) and versions of Python. What is the standard way to cross-compile your extensions for different environments? Wine? Virtual machines? Crowd sourcing?
How do you compile Python C/C++ extensions for different OS/versions of Python?
8,785,299
0
8
2,222
0
python,cross-platform,packaging,python-c-extension
SWIG provides a path for multiplatform code generation.
0
1
0
0
2012-01-04T04:11:00.000
3
0
false
8,721,918
1
0
0
2
I have noticed that several mature Python libraries have precompiled versions for most architectures (Win32/Win-amd64/MacOS) and versions of Python. What is the standard way to cross-compile your extensions for different environments? Wine? Virtual machines? Crowd sourcing?
What does an image look like as a Blob?
8,722,451
2
1
2,977
0
python,image,google-app-engine,blob
"Blob" stands for "Binary Large OBject". It's bytes. Just instantiate a db.Blob, passing the bytes.
0
1
0
0
2012-01-04T05:29:00.000
2
0.197375
false
8,722,427
0
0
1
1
I am working on an AppEngine application, to store images, they have to be stored in a BlobProperty. Is there a Mac/Linux way to convert images to their Blob representation or is there any tool (especially online) that can do this?
How to run a python script from another python script and get the returned status code?
8,724,602
0
6
2,400
0
python,bash
I would suggest you to look at the subprocess module in python. You can start another process using it, manipulate its streams and get the return code.
0
1
0
1
2012-01-04T09:26:00.000
2
0
false
8,724,557
0
0
0
1
I'm relatively new to both Python and bash. However, I am finding Python much more intuitive and easier than bash. I have a few bash scripts I have managed to cobble together, but I would like to replace them with Python scripts - for ease of maintenance etc. The bash scripts essentially run python scripts, check the returned status code and act appropriately (e.g. log a message, fire off an email etc) - this is functionality that I thing I can for the most part, reproduce in a Python script. The one thing I am not sure of how to do, is how to run a python script from another python script and get the returned status code. Can anyone post a snippet here that will show how to run a small python script 'test.py' from a main python script 'master.py' and correctly retrieve the return code after running test.py from master.py?
How to start a script based on an event?
8,732,259
-1
2
176
0
python,bash,redhat
This is a job for cron. Cron man, man cron!
0
1
0
0
2012-01-04T17:26:00.000
6
-0.033321
false
8,731,179
1
0
0
1
I'm in a red hat environment. I need to move a file from server A to server B when a file is available in a folder F. THere's no constraint on the method used. Is it possible to trigger this event in python or any other scripts? It could be run as a daemon but I'm not sure how to do that. Any advices?
AppEngine Datastore query with inequality and sort (different attribute). Workaround?
8,735,561
2
0
177
0
python,google-app-engine
No, there's no way around this. This limitation exists due to how indexes are constructed. You'll simply have to do either the sorting or the filtering in memory, just as other databases would.
0
1
0
0
2012-01-04T20:16:00.000
1
1.2
true
8,733,403
0
0
1
1
Hey guys I know this is an old issue but I am wondering if there any news about it: I have a simple query where I want to do: filter('created >=', somedatetime).order('-counter') I tried: filter('created >=', somedatetime).order('-created').order('-counter') but because created is a datetime the results are pretty bad. A user can go through a list with infinite scrolling and we can choose a time window of 7,30,90 days but it seems I cannot this very simple query. I was thinking of break created to two attributes (dayofyear, year) so that I could use the IN operator but this could be hard as I have about 2M entries. Any ideas?
How to add Python Egg to Eclipse Pydev paths? New Egg button not behaving as expected
21,244,922
1
1
2,346
0
python,eclipse,pydev
Go to: Window > Preferences > PyDev > Interpreter - (Python, Iron python, or Jython) > Libraries You can add a new folder, using the New folder Button, You can add a new egg, using the New Egg button, or remove. If you are experimenting with new versions of libraries, I suggest to remove the old versions, restart eclipse, install the new ones, then restart eclipse again. Cheers !! happy PyDeving !!
0
1
0
1
2012-01-05T22:07:00.000
3
0.066568
false
8,750,530
1
0
0
3
I'm trying to add a python egg to my eclipse pydev path via Eclipse Settings -> PyDev -> Interpreter - Python -> New Egg/Zip(s), and in the dialog where I browse to the egg file, and click the "open" button on the dialog, it simply keeps the dialog open and browses into the egg. This is on OS X with Helios SR 2.
How to add Python Egg to Eclipse Pydev paths? New Egg button not behaving as expected
21,922,683
2
1
2,346
0
python,eclipse,pydev
On my Mac I have some .egg's that are files, and some .egg's that are folders, for example my SQLObject is a folder but my oauth is a file. I am not exactly sure why, it could be because of how I downloaded and installed them. The ones that are folders can't be chosen by the "Add zip/jar/egg" chooser, but the simple solution is just to include those via "Add source folder".
0
1
0
1
2012-01-05T22:07:00.000
3
0.132549
false
8,750,530
1
0
0
3
I'm trying to add a python egg to my eclipse pydev path via Eclipse Settings -> PyDev -> Interpreter - Python -> New Egg/Zip(s), and in the dialog where I browse to the egg file, and click the "open" button on the dialog, it simply keeps the dialog open and browses into the egg. This is on OS X with Helios SR 2.
How to add Python Egg to Eclipse Pydev paths? New Egg button not behaving as expected
8,750,576
1
1
2,346
0
python,eclipse,pydev
Perhaps this only on OS X, but simple solution was to just add the egg as a folder via New Folder. I'm guessing the New Egg/Zip button is for OS's that don't treat Zips/Eggs as folders.
0
1
0
1
2012-01-05T22:07:00.000
3
1.2
true
8,750,530
1
0
0
3
I'm trying to add a python egg to my eclipse pydev path via Eclipse Settings -> PyDev -> Interpreter - Python -> New Egg/Zip(s), and in the dialog where I browse to the egg file, and click the "open" button on the dialog, it simply keeps the dialog open and browses into the egg. This is on OS X with Helios SR 2.
Is it possible to return a reference property in an App Engine computed property?
8,752,433
2
0
86
0
python,google-app-engine,model,reference
To do this you'd have to write your own custom Property subclass. You should be able to do so by examining the code behind ComputedProperty and ReferenceProperty; in effect you'd be combining the two.
0
1
0
0
2012-01-06T01:06:00.000
1
1.2
true
8,752,168
0
0
1
1
I have a model with an attribute that is a reference to another model. The model it references depends on some logic. Is there a way to have a computed property that gives me the same ReferenceProperty niceties (reverse references, dereferencing)? So far I the computed property stores a db.Key, but this is not optimal. Can I have a Computed Reference Property?
How to use SSL in Python?
8,762,875
1
1
1,280
0
python,google-app-engine,ssl
"Use" SLL for what? Joachim has answered regarding serving your pages over SSL. If you want an SSL client, then urlfetch allows https URLS. It gives you no control other than the "validate_certificate" boolean parameter, and I don't immediately see any documentation of what CAs/certificates it trusts. Of course it doesn't support any protocol other than HTTPS, but that's in keeping with the fact that in general, GAE does not allow free use of sockets.
0
1
0
0
2012-01-06T18:44:00.000
2
0.099668
false
8,762,797
0
0
0
1
I want to use SSL on Google App Engine. Is there a 3rd-party Python module I must use or can I just use the Google SDK?
How to programmatically determine default applications in linux
8,764,283
1
8
2,033
0
python,linux,shell,default-programs
Per-user environment variables tells you that. $EDITOR gives you the command to be launched as text editor; $BROWSER gives you the browser $PAGER gives you the pager (ex. more or less). This however is valid for command line softwares, while usually desktop environments use their own (internal) variables. Also in python you can read the environment variables using os.getenv.
0
1
0
0
2012-01-06T20:44:00.000
6
0.033321
false
8,764,244
0
0
0
3
In linux, how can I determine the default text editor, terminal, etc? does it vary by distro?
How to programmatically determine default applications in linux
8,764,364
3
8
2,033
0
python,linux,shell,default-programs
I accessed the list while ago programatically in a rather ugly manner and I'm sure its not the best way. The options are stored in a file called defaults.list (I think this is generally the case). The location is less general I think it in /usr/share/applications/ on my ubuntu system although it does appear elsewhere I think. I then treated it as a text file.
0
1
0
0
2012-01-06T20:44:00.000
6
0.099668
false
8,764,244
0
0
0
3
In linux, how can I determine the default text editor, terminal, etc? does it vary by distro?
How to programmatically determine default applications in linux
8,764,453
2
8
2,033
0
python,linux,shell,default-programs
The resolution order is $EDITOR -> editor -> some predefined list of console editors. On Debian/Ubuntu, sensible-editor (and sensible-browser and sensible-pager) will do the lookup for you, including looking at the right environment variables. Similar variables are $PAGER, $SHELL, $BROWSER. To look up a file association, you can use xdg-open.
0
1
0
0
2012-01-06T20:44:00.000
6
0.066568
false
8,764,244
0
0
0
3
In linux, how can I determine the default text editor, terminal, etc? does it vary by distro?
Installed a python2.7 as an alternate, but path to default 2.6 is destroyed. System path file for default interpreter?
8,764,672
4
2
5,778
0
python,linux,centos
This is because /usr/local/bin comes before /bin in your $PATH. What does which python say? I suspect it gives a symlink /usr/local/bin/python to /usr/local/bin/python2.7. Changing that symlink to /bin/python or removing it altogether should fix your problem.
0
1
0
1
2012-01-06T21:08:00.000
1
1.2
true
8,764,562
0
0
0
1
I installed python2.7 as an alternate version of python. I was attempting to utilize a newer version of mod_python and I needed 2.7. The default python (/bin/python) is 2.6. Unfortunately now, calling python from the command line calls /usr/local/bin/python2.7. I realize that I can set up a number of links pointing back to /bin/python--I just don't think this is a great idea. The OS (CentOS6) uses 2.6.2 by default, and I don't want the OS to use another version of python. I installed 2.7 from source, but forgot to specify 'make altinstall' rather than 'make install'. This is a semi-work related server, so I need to implement something that will permanently fix the problem. I realize .profile and .bashrc have paths for python, but these appear to be more for bash logins via ssh. I need to find a way to change the system's default python path back to 2.6.2. How would one go about doing this? Thank you for your help.
Get the text of a python script that is passed via the `-c` option
8,766,362
1
1
48
0
python
As far as I know, it's not possible.
0
1
0
1
2012-01-07T00:39:00.000
2
1.2
true
8,766,312
0
0
0
2
If I run a python script via python foo.py then I can get the contents of the script by reading the file sys.argv[0]. Is it possible to get the contents of the script (e.g., as a string) if the script is passed to the python interpreter via python -c "$(cat foo.py)"?
Get the text of a python script that is passed via the `-c` option
8,766,445
0
1
48
0
python
No. As far as I know, It wont be possible. When you call "$(cat foo.py)", shell will get only the contents and the reference is lost.
0
1
0
1
2012-01-07T00:39:00.000
2
0
false
8,766,312
0
0
0
2
If I run a python script via python foo.py then I can get the contents of the script by reading the file sys.argv[0]. Is it possible to get the contents of the script (e.g., as a string) if the script is passed to the python interpreter via python -c "$(cat foo.py)"?
open source monitoring solution without the need of an agent
8,777,056
0
0
482
0
python,open-source,monitoring
All tools that allow you to run scripts to gather metrics can basically run commands over a ssh connection on the target box. The question is though if this makes a lot of sense as you rely on the network connection always being available and for each (set of) property(s) you need to run a new remote connection with all its overhead. Snmp does by definition of the protocol require you to run an snmp agent on the target box.
0
1
0
1
2012-01-07T15:53:00.000
1
1.2
true
8,770,914
0
0
0
1
I am looking for an open source monitoring solution (preferably in Python) that works with ssh or snmp and does not require the installation of an agent (like Nagios, ZenOSS, munin). Are you aware of such a solution?
Reliable and "as portable as possible" way to map from device name to mountpoint in Python
8,785,305
1
3
1,462
0
python,linux,macos,unix
What about reading /etc/mtab and /etc/fstab? I don't know OSX, but that's the standard Unix way to know what is mounted where. mtab should list all mounted filesystems, fstab should list all predefined mountpoints (which may or may not actually be mounted).
0
1
0
0
2012-01-09T07:38:00.000
4
0.049958
false
8,785,217
0
0
0
1
I want to be able to take a device name (eg: /dev/disk2) and determine where (if anywhere) it's mounted (eg: /mnt/cdrom or /Volumes/RANDLABEL) in Python. One way I can do this is to run df or mount and then parse the output, but this seems pretty cheesy and unreliable. For example, mount uses " on " as the delimiter between the device and the mountpoint. While very unlikely, either of these could potentially include that very string, making the output ambiguous. On Linux I could read /proc/mounts, but this won't work on Mac OS X, for example. So I'm looking for a way to find the mountpoint for a device in a way that's reliable (ie: can deal with arbitrary (legal) device/mountpoint names) and is "as portable as possible". (I'm guessing that portability to Windows might not be possible -- I'm not sure if it even has an analogous concept of device mountpoints.) I particularly want something that will work on both Linux and OS X.
Convert HTML HEX Color or RGB tuple to X11 color
8,791,192
1
2
2,309
0
python,colors,hex,x11,rgb
You can't convert to x11 colors automatically. x11 colors are basically just names mapped to arbitrary RGB values, so the only way to get from RGB to x11 is to reverse the map. If you want to convert an RGB color that isn't in x11 to the closest match in x11 that would be pretty difficult.
0
1
0
0
2012-01-09T15:12:00.000
4
0.049958
false
8,790,555
0
0
0
2
I'm searching for a single function to convert RGB tuple (255, 255, 255) or HTML hex (#FFFFFF) to X11 color (0...255 int) to manage colors in Unix terminal. I've looked over the internet but I didn't find anything like that, so I'm asking for code or link to a website that contains code or information about how I can do this in Python.
Convert HTML HEX Color or RGB tuple to X11 color
8,791,219
1
2
2,309
0
python,colors,hex,x11,rgb
If I understand your question properly, I don't think you can do this. The RGB tuple (and its representation as a 6-digit hex number for HTML) represents a specific color in the RGB colorspace. The single integer in the range 0 to 255 you mention for the Unix terminal isn't a specific color, but rather an index into a color table. As an example, color 15 on one terminal may be #ff0000, but #33ff33 on another. There really isn't a conversion between the two.
0
1
0
0
2012-01-09T15:12:00.000
4
0.049958
false
8,790,555
0
0
0
2
I'm searching for a single function to convert RGB tuple (255, 255, 255) or HTML hex (#FFFFFF) to X11 color (0...255 int) to manage colors in Unix terminal. I've looked over the internet but I didn't find anything like that, so I'm asking for code or link to a website that contains code or information about how I can do this in Python.
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
34,907,888
13
46
100,963
0
python,python-idle
One way to run IDLE from spotlight or an icon in the Applications folder is to build a quick Automation for it. As mentioned by other commentators, this probably isn't necessary for Python 3, as it creates a shortcut automatically, and some hand-installed versions have tools to do this automatically. But if you want to roll your own: You'll need to know the terminal command to open your version of IDLE. On my Mac right now (early 2016), running python 2.7.10, it is "idle2.7" Using spotlight, or in the Utilities folder, open "Automator" Choose an "Application" type document. Make sure "Actions" is selected in the gray bar, upper left. In the actions column, find "Run Shell Script" and double-click it, or drag it to the workflow area on the right. Enter the terminal command in the parameters box that appears. Save your automation (I called mine "IDLE" and put it in the Applications folder, to make it easy). It's now available (as soon as spotlight indexes it) via all the normal methods. The only side-effect will be that while it's running, your menu bar will have a spinning gear over in the tray area next to the clock. This indicates an automation workflow is running. Once you close IDLE, it will go away.
0
1
0
0
2012-01-09T16:50:00.000
10
1
false
8,792,044
1
0
0
6
I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
45,255,372
2
46
100,963
0
python,python-idle
first to launch the terminal CMD+space second to input idle3 the idle will be activated automatically.
0
1
0
0
2012-01-09T16:50:00.000
10
0.039979
false
8,792,044
1
0
0
6
I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
8,792,311
63
46
100,963
0
python,python-idle
In the stock Mac OS X python installation, idle is found in /usr/bin, which is not (easily) accessible from Finder and not indexed by Spotlight. The quickest option is to open the Terminal utility and type 'idle' at the prompt. For a more Mac-like way of opening it, you'll have to create a small app or shortcut to launch /usr/bin/idle for you (an exercise left to the reader).
0
1
0
0
2012-01-09T16:50:00.000
10
1.2
true
8,792,044
1
0
0
6
I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
32,878,774
0
46
100,963
0
python,python-idle
As to the earlier questions about starting IDLE: you can certainly start it from the command line. Also, if you installed Python using Homebrew, you can run 'brew linkapps' (from the command line); that will place an app for IDLE (among other things) in Launchpad (Applications folder).
0
1
0
0
2012-01-09T16:50:00.000
10
0
false
8,792,044
1
0
0
6
I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
32,877,359
1
46
100,963
0
python,python-idle
After you launch idle from the command line (make sure idle shell window has focus), click File, click "New File". A new window opens; this is your editor. Type your program in the editor. Click "File", click "Save As...". Save your file somewhere with any name you choose, and a ".py" extension to the file name. Click "Run", click "Run Module" (or, F5). Assuming no errors, the results will appear in the Shell window. Edit your file & repeat as necessary.
0
1
0
0
2012-01-09T16:50:00.000
10
0.019997
false
8,792,044
1
0
0
6
I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
35,586,250
1
46
100,963
0
python,python-idle
The answer of Matthewm1970 works like a charm! And if you add an & to your shell command, the automation script will end immediately. There is no spinning gear. Like so: /usr/local/bin/idle3.5& Note the ampersand. Cheers. -melle
0
1
0
0
2012-01-09T16:50:00.000
10
0.019997
false
8,792,044
1
0
0
6
I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
Handling GAE BlobStore Exception via webapp2 handler
8,797,080
3
1
194
0
python,google-app-engine,requesthandler
The 413 is generated by the App Engine infrastructure; the request neve reaches your app, so it's impossible to handle this condition yourself.
0
1
0
0
2012-01-09T22:12:00.000
1
0.53705
false
8,795,879
0
0
1
1
I have been banging my head around on this issue for a bit and have not come up with a solution. I am attempting to trap the exception UploadEntityTooLargeEntity. This exception is raised by GAE when 2 things happen. Set the max_bytes_total param in the create_upload_url: self.template_values['AVATAR_SAVE_URL'] = blobstore.create_upload_url('/saveavatar, max_bytes_total= 524288) Attempt to post an item that exceeds the max_bytes_total. I expect that, since my class is derived from RequestHandler that my error() method would be called. Instead I am getting a 413 screen telling me the upload is too large. My request handler is derived from webapp2.RequestHandler. Is it expected that GAE will work with the error method derived from webapp2.RequestHandler? I'm not seeing this in GAE's code but I can't imagine there would be such an omission.
URLFetch behind a Proxy Server on App Engine Production
8,807,655
3
6
2,065
0
python,google-app-engine,proxy,urlfetch
You can always roll your own: In case of fixed destination: just setup a fixed port forwarding on a proxy server. Then send requests from GAE to proxy. If you have multiple destinations, then set forwarding on separate ports, one for each destination. In case of dynamic destination (too much to handle via fixed port forwarding), your GAE app adds a custom http header (X-Something) containing final destination and then connects to custom proxy. Custom proxy inspects this field and forwards the request to the destination.
0
1
0
0
2012-01-10T07:27:00.000
2
1.2
true
8,799,886
0
0
1
1
Is there a way to specify a proxy server when using urlfetch on Google App Engine? Specifically, every time I make a call using urlfetch, I want GAE to go through a proxy server. I want to do this on production, not just dev. I want to use a proxy because there are problems with using google's outbound IP addresses (rate limiting, no static outbound IP, sometimes blacklisted, etc.). Setting a proxy is normally easy if you can edit the http message itself, but GAE's API does not appear to let you do this.
Routing all packets through my program?
8,808,582
1
5
2,625
0
java,python,networking,tcp,tunnel
If you want to route only tcp traffic is actually kind of simple using threads and sockets. You should listen in a different port for every server you want to reach. Either in Java or Python you have to create a "socket" for every port you want to listen in. For every new connection you create a new connection to the server and create two new threads to handle that connection, one thread will be reading everything from the client and sending it to the server. The other will be reading everything from the server and sending it to the client. When any end of the connection closes it, you close the other and end both threads.
0
1
1
0
2012-01-10T18:01:00.000
4
0.049958
false
8,808,104
0
0
0
1
I want to build an application that routes all network traffic (not just HTTP) through my application. Basically, what I want is all the traffic to be given to my application (they should never reach the actual target, my application should handle this), which will in turn be forwarded to a server; same goes for input, just reversed (server -> application -> program which wants an answer). Are there any libraries (or similar stuff) that would make creating the application easier? I'm looking for something that I can use from Python or Java, but if it's really needed, I can learn another language.
Sending SIGINT (Ctrl-C) to program running in Eclipse Console
61,871,564
0
29
15,315
0
python,eclipse,twisted,sigint
in some versions, you can do the following. In the Debug perspective, you can open a view called "Signals" (Window/Show View/Signals" or Left-Bottom Icon). You will get a list of all supported signals. Right-click and "Resume with Signal" will give you the result you need.
0
1
0
1
2012-01-11T05:01:00.000
5
0
false
8,814,383
0
0
0
1
I have setup a run configuration in Eclipse and need to send SIGINT (Ctrl+C) to the program. There is cleanup code in the program that runs after SIGINT, so pressing Eclipse's "Terminate" buttons won't work (they send SIGKILL I think). Typing CTRL+C into the Console also doesn't work. How do I send SIGINT to a process running inside an Eclipse Console? (FWIW I am running a Twisted daemon and need Twisted to shutdown correctly, which only occurs on SIGINT)
Python locks that go away when process dies
8,823,470
1
1
744
0
python,locking,ipc
You could apply locks to a file using fcntl.lockf or fcntl.flock. That seems to meet all your criteria. Or do you need something that doesn't require a system call every time you want to lock or unlock?
0
1
0
0
2012-01-11T16:42:00.000
3
1.2
true
8,823,088
1
0
0
1
Is there any locking interface for Python that automatically breaks the lock when the process dies? I was under the impression that sysv ipc allows for that, but I'm still trying to figure out the details. What I expect from the interface: lock / release functions working between different processes on Linux automatic unlock when the process holding the lock dies forced lock breaking on timeout (not necessary)
How could I do this kind of scheduled task in AppEngine Python?
8,838,811
2
0
170
0
python,google-app-engine
You've said that you're storing the target time in the Alarm table. So, your cron just has to run every minute (or every 5 or 10, depending on the resolution of your alarms) and check if there's an alarm matching the current time, and if so then do the action.
0
1
0
0
2012-01-12T15:46:00.000
2
1.2
true
8,837,899
0
0
1
1
I have a form with a text field for entering a number without decimal places representing an amount of minutes that will have to be added to the current time and will be inserted into a table named Alarm. When the resulting time comes, my web app must make an insert operation over another table. For example, if the user enters 20 minutes, and the current time is 22:10, the result time will have to be 22:30 and will be inserted into Alarm table. So, when the 22:30 arrives, a new insert will have to be made over the another table. How can I do this on AppEngine using Python?
Custom logs in AppEngine
8,848,350
3
2
228
0
python,google-app-engine,logging
I had a similar logging in my app, and what I did is to set up a simple servlet in a self-hosted server that receives the log string and level and store them in our local database. Each time I need this kind of log, I use asynchronous URLFetch to send the data from our app to our logging server. I could store the log data in the datastore, but then I would lose the option to do full text search of my log strings, which in my experience is invaluable when you're sifting through log files. I could also store the log in an external file and grep only the lines that I need.
0
1
0
0
2012-01-12T16:08:00.000
2
1.2
true
8,838,243
0
0
1
2
I have an application for which I would like to record some statistics for later analysis but which are not at all needed within the application itself. i.e. The data will never need to be read by the application. Whatever system is used for storing these statistics, I just need to be able to take periodic dumps of the data. I could use the logging built into AppEngine, but then it will display in the application logs. I would like to keep the application logs for debugging the application without having to see other custom information every time I check them. How would you do this? Edit: More details on the stats. Each time a user completed a particular task (1-3 times a day) we need to store details about that task. Such as time and order of events. These would be stored in a single string per session - 1-2kB.
Custom logs in AppEngine
8,844,141
2
2
228
0
python,google-app-engine,logging
Your best option is to store this data in the datastore. If you're concerned about latency, you can either use asynchronous operations, and start the write as soon as possible, or you can use the task queue to do the writes offline.
0
1
0
0
2012-01-12T16:08:00.000
2
0.197375
false
8,838,243
0
0
1
2
I have an application for which I would like to record some statistics for later analysis but which are not at all needed within the application itself. i.e. The data will never need to be read by the application. Whatever system is used for storing these statistics, I just need to be able to take periodic dumps of the data. I could use the logging built into AppEngine, but then it will display in the application logs. I would like to keep the application logs for debugging the application without having to see other custom information every time I check them. How would you do this? Edit: More details on the stats. Each time a user completed a particular task (1-3 times a day) we need to store details about that task. Such as time and order of events. These would be stored in a single string per session - 1-2kB.
How to make pydev compile to .pyo and not .pyc
8,842,240
0
1
633
0
python,eclipse,pydev
I don't think you can make pydev default to .pyo, but you can always pass "-O" as a VM argument in Run Configurations.
0
1
0
0
2012-01-12T18:00:00.000
2
1.2
true
8,839,930
1
0
0
2
I am using Eclipse with Pydev 1.5.7 installed. I am also using Python 2.5. By default, Pydev compiles to .pyc. How do I make it compile to .pyo by default
How to make pydev compile to .pyo and not .pyc
67,301,483
0
1
633
0
python,eclipse,pydev
Or add PYTHONOPTIMIZE = 2 as environment variable in the run configuration dialog.
0
1
0
0
2012-01-12T18:00:00.000
2
0
false
8,839,930
1
0
0
2
I am using Eclipse with Pydev 1.5.7 installed. I am also using Python 2.5. By default, Pydev compiles to .pyc. How do I make it compile to .pyo by default
appengine datastore - filter by string or integer
8,844,099
2
1
276
0
python,google-app-engine,google-cloud-datastore
Practically speaking, no. Any difference in the efficiency of comparing different datatypes is insignificant compared to disk access times.
0
1
0
0
2012-01-12T19:20:00.000
1
1.2
true
8,840,999
0
0
1
1
Will a query with a filter over IntegerProperty perform any better than a query with a filter over String Property? (same indexes)
How to enable python interactive mode in cygwin?
60,981,831
0
23
9,333
0
python,cygwin,command-prompt
A Windows install of ActiveState python won't enter interactive mode, AND it will be run instead of cygwin Python even if you have cygwin Python installed, because ActiveState python inserts its bin path at the front of your Windows System PATH environment variables. I solved it by going (in Windows) to Control Panel->System -> Advanced system settings-> Environment variables, choosing PATH, selecting Edit, and cut-pasting all the ActiveState entries from the front to the back of the PATH list.
0
1
0
0
2012-01-12T19:29:00.000
3
0
false
8,841,110
1
0
0
1
I like python in interactive mode when on linux. However on cygwin, the interactive mode doesn't start. I don't see the ">>>" prompt and whatever I enter doesn't result in anything. Solved: I figured out the problem from the answers below. I was using a windows installation of python and it needs -i option to start in interactive mode.
Google App Engine Go-Python/Java hybrid application
8,847,345
5
1
469
0
java,python,google-app-engine,go,hybrid
You can deploy several "versions" of the same application at once. Each version will be accessible using a fully qualified URL, and they can all be in different languages.
0
1
0
0
2012-01-13T07:31:00.000
1
1.2
true
8,847,266
0
0
1
1
Can one write a hybrid Go-Python/Java application and run it on Google App Engine as one application, or do they need to be split into two apps and communicate with each other through HTTP calls? Is there any tutorial or example on something like this being done?
Can we cascade multiple MapReduce jobs in Hadoop Streaming (lang: Python)
8,860,677
3
3
1,886
0
python,hadoop,mapreduce,hadoop-streaming
b) I dont want to store intermediate files c) I dont want to install packages like Cascading, Yelp, Oozie. Any reason why? Based on the response, a better solution could be provided. Intermediates files cannot be avoided, because the o/p of the previous Hadoop job cannot be streamed as i/p to the next job. Create a script like this run streaming job1 if job1 is not success then exit run streaming job2 if job2 is success them remove o/p of job1 else exit run streaming job3 if job3 is succcess them remove o/p of job2 else exit
0
1
0
0
2012-01-14T04:46:00.000
2
1.2
true
8,860,214
0
0
0
1
I am using Python and have to work on following scenario using Hadoop Streaming: a) Map1->Reduce1->Map2->Reduce2 b) I dont want to store intermediate files c) I dont want to install packages like Cascading, Yelp, Oozie. I have kept them as last option. I already went through the same kind of discussion on SO and elsewhere but could not find an answer wrt Python. Can you please suggest.
Is there any scripting support on Windows Phone?
8,893,061
2
7
4,362
0
python,perl,windows-phone-7,powershell,smartphone
You can use Powershell in the service layer, adding System.Management.Automation and Microsoft.PowerShell.Commands.Utility to the service project.
0
1
0
0
2012-01-17T09:39:00.000
4
0.099668
false
8,892,357
0
0
0
1
In Windows Mango OS , is there any scripting environment that is supported? Does it have support for powershell or python or perl?
Execute Python CGI from /cgi-bin/ folder
8,911,061
0
1
3,691
0
python,apache2,cgi
please make sure: the file you are calling itself has enough permission the file you are calling has an extension that is is in the .htaccess file (see newtover's answer) specify how you want to run the script in the first line of the file. If you are calling foo.pl, make sure #!/usr/bin/perl is in the first line.
0
1
0
1
2012-01-18T13:17:00.000
2
0
false
8,910,770
0
0
0
1
I have a standard Apache2 installation on an Ubuntu server. The default settings use ScriptAlias to refer /cgi-bin/ to /usr/lib/cgi-bin/. If I place my Python CGI script in /usr/lib/cgi-bin/ it executes. I created /var/www/cgi-bin/ with appropriate permissions, removed the ScriptAlias line, changed the Directory entry in the default file for the site, moved the CGI file to /var/www/cgi-bin/ and restarted Apache2, but I was not able to get the script to run. It was appearing as a text file in the browser instead of being executed. The HTML file calling the script refers to /cgi-bin/SCRIPT, so I left that unchanged. I tried variations on /cgi-bin and /var/www/cgi-bin in the config files without success. How can I get a Python CGI file to run from /var/www/cgi-bin?
How I can request a local url in my app engine application?
8,915,133
2
1
165
0
python,json,google-app-engine,url,blob
This wouldn't on the development server (but will work on the production server) because its single threaded and you can't do a request to yourself from within a request. There are several workarounds for your issue: Use the file write API to store the data. Use the multithread dev_server (required to switch to python 2.7 + HRD) Store the file asynchronously using queues or deferred.
0
1
0
0
2012-01-18T18:04:00.000
2
0.197375
false
8,915,042
0
0
1
1
I am using Blobs to store json files for my application. What I am trying to achieve is to request an internal url of my application in order to get the relevant file. I have tried urllib, urllib2, urlfetch but every time I am getting a 5 second DeadlineExceededError: 5 timed out error. Is there a way to retrieve my blob in my get request or an alternative for retrieving my data?
Which version of Python do I have installed?
60,124,084
4
529
1,459,615
0
python,version,windows-server
Typing where python on Windows into a Command Prompt may tell you where multiple different versions of python are installed, assuming they have been added to your path. Typing python -V into the Command Prompt should display the version.
0
1
0
0
2012-01-18T21:43:00.000
24
0.033321
false
8,917,885
1
0
0
4
I have to run a Python script on a Windows server. How can I know which version of Python I have, and does it even really matter? I was thinking of updating to the latest version of Python.
Which version of Python do I have installed?
45,665,525
3
529
1,459,615
0
python,version,windows-server
If you have Python installed then the easiest way you can check the version number is by typing "python" in your command prompt. It will show you the version number and if it is running on 32 bit or 64 bit and some other information. For some applications you would want to have a latest version and sometimes not. It depends on what packages you want to install or use.
0
1
0
0
2012-01-18T21:43:00.000
24
0.024995
false
8,917,885
1
0
0
4
I have to run a Python script on a Windows server. How can I know which version of Python I have, and does it even really matter? I was thinking of updating to the latest version of Python.
Which version of Python do I have installed?
44,818,859
-2
529
1,459,615
0
python,version,windows-server
Open a command prompt window (press Windows + R, type in cmd, and hit Enter). Type python.exe
0
1
0
0
2012-01-18T21:43:00.000
24
-0.016665
false
8,917,885
1
0
0
4
I have to run a Python script on a Windows server. How can I know which version of Python I have, and does it even really matter? I was thinking of updating to the latest version of Python.
Which version of Python do I have installed?
8,917,940
24
529
1,459,615
0
python,version,windows-server
When I open Python (command line) the first thing it tells me is the version.
0
1
0
0
2012-01-18T21:43:00.000
24
1
false
8,917,885
1
0
0
4
I have to run a Python script on a Windows server. How can I know which version of Python I have, and does it even really matter? I was thinking of updating to the latest version of Python.
Issue with virtualenv - cannot activate
71,692,901
0
190
352,338
0
python,virtualenv
if .\venv\Scripts\activate does not work neither and you find this error \Activate.ps1 cannot be loaded because running scripts is disabled on this system you can simple type set-executionpolicy remotesigned in powershell and the error must be gone. powershell should run as administrator
0
1
0
0
2012-01-19T04:54:00.000
34
0
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
62,498,657
4
190
352,338
0
python,virtualenv
Open your powershell as admin Enter "Set-ExecutionPolicy RemoteSigned -Force Run "gpedit.msc" and go to >Administrative Templates>Windows Components>Windows Powershell Look for "Activate scripts execution" and set it on "Activated" Set execution directive to "Allow All" Apply Refresh your env
0
1
0
0
2012-01-19T04:54:00.000
34
0.023525
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
65,636,990
0
190
352,338
0
python,virtualenv
If you are using windows, just run .\Scripts\activate. Mind that the backslash plays the trick!
0
1
0
0
2012-01-19T04:54:00.000
34
0
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
71,559,922
-1
190
352,338
0
python,virtualenv
Some people are having trouble with vscode i assume as all the above methods dont work. Its simply because by default vscode uses powershell not cmd... click on the little arrow beside it and select cmd and run the command.
0
1
0
0
2012-01-19T04:54:00.000
34
-0.005882
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
71,215,993
1
190
352,338
0
python,virtualenv
The steps for activating virtualenv using Python3 on windows are: python3 -m venv env .\env\bin\activate
0
1
0
0
2012-01-19T04:54:00.000
34
0.005882
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
60,413,441
0
190
352,338
0
python,virtualenv
Open your project using VS code editor . Change the default shell in vs code terminal to git bash. now your project is open with bash console and right path, put "source venv\Scripts\activate" in Windows
0
1
0
0
2012-01-19T04:54:00.000
34
0
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
67,224,356
2
190
352,338
0
python,virtualenv
For windows Microsoft Tech Support it might be a problem with Execution Policy Settings. To fix it, you should try executing Set-ExecutionPolicy Unrestricted -Scope Process
0
1
0
0
2012-01-19T04:54:00.000
34
0.011764
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
71,382,806
0
190
352,338
0
python,virtualenv
It's been a while without usign Django, so when I got back to my old project I run into the same issue on Windows 10 and this worked for me: venv/Scripts/activate
0
1
0
0
2012-01-19T04:54:00.000
34
0
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
71,376,740
0
190
352,338
0
python,virtualenv
Use These it worked for meenv\Scripts\activate
0
1
0
0
2012-01-19T04:54:00.000
34
0
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
59,298,771
0
190
352,338
0
python,virtualenv
If you are using windows OS then in Gitbash terminal use the following command $source venv/Scripts/activate. This will help you to enter the virtual environment.
0
1
0
0
2012-01-19T04:54:00.000
34
0
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
47,483,536
21
190
352,338
0
python,virtualenv
For activation you can go to the venv your virtualenv directory by cd venv. Then on Windows, type dir (on unix, type ls). You will get 5 folders include, Lib, Scripts, tcl and 60 Now type .\Scripts\activate to activate your virtualenv venv. Your prompt will change to indicate that you are now operating within the virtual environment. It will look something like this (venv)user@host:~/venv$. And your venv is activated now.
0
1
0
0
2012-01-19T04:54:00.000
34
1
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
61,607,988
0
190
352,338
0
python,virtualenv
Navigate to your virtualenv folder eg ..\project1_env> Then type source scripts/activate eg ..\project1_env>source scripts/activate
0
1
0
0
2012-01-19T04:54:00.000
34
0
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
61,962,316
0
190
352,338
0
python,virtualenv
If some beginner, like me, has followed multiple Python tutorials now possible has multiple Python versions and/or multiple versions of pip/virtualenv/pipenv... In that case, answers listed, while many correct, might not help. The first thing I would try in your place is uninstall and reinstall Python and go from there.
0
1
0
0
2012-01-19T04:54:00.000
34
0
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
25,353,183
2
190
352,338
0
python,virtualenv
I have a hell of a time using virtualenv on windows with git bash, I usually end up specifying the python binary explicitly. If my environment is in say .env I'll call python via ./.env/Scripts/python.exe …, or in a shebang line #!./.env/Scripts/python.exe; Both assuming your working directory contains your virtualenv (.env).
0
1
0
0
2012-01-19T04:54:00.000
34
0.011764
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
48,840,058
2
190
352,338
0
python,virtualenv
You can run the source command on cygwin terminal
0
1
0
0
2012-01-19T04:54:00.000
34
0.011764
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
53,059,234
1
190
352,338
0
python,virtualenv
If you see the 5 folders (Include,Lib,Scripts,tcl,pip-selfcheck) after using the virtualenv yourenvname command, change directory to Scripts folder in the cmd itself and simply use "activate" command.
0
1
0
0
2012-01-19T04:54:00.000
34
0.005882
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
58,090,444
0
190
352,338
0
python,virtualenv
If you’re using Windows, use the command "venv\Scripts\activate" (without the word source) to activate the virtual environment. If you’re using PowerShell, you might need to capitalize Activate.
0
1
0
0
2012-01-19T04:54:00.000
34
0
false
8,921,188
1
0
0
17
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
How I combine cygwin style path (/cygdrive/) and windows version of Python?
8,938,397
1
2
4,533
0
python,cygwin
You should use the python interpreter from inside cygwin POSIX environment.
0
1
0
0
2012-01-20T06:46:00.000
2
1.2
true
8,937,709
1
0
0
1
I have .sh script that executes .py script and it doesn't work giving me following error: C:\Python27\python.exe: can't open file '/cygdrive/c/NewFolder/Kindle/Src_Updater/kindle_update_tool_lite.py': [Errno 2] No such file or directory How can I combine cygwin style path (/cygdrive/) and windows version of Python without changing scripts?
python appengine memcache optimization
8,980,637
1
0
259
0
python,google-app-engine,memcached,djangoappengine
Cache everything that might be frequent, and let Memcache's LRU policy evict items that aren't accessed frequently enough to warrant remaining in the cache.
0
1
0
0
2012-01-20T12:05:00.000
2
0.099668
false
8,941,192
0
0
1
1
I am developing an api on google appengine django nonrel that will serve a lot of requests. I would like to cache repeated requests. It is estimated that there will be some really frequent queries to the api, and I would like to be able to find out what these queries are on the fly so that I may pre-cache them. Is there a way of getting the most frequent memcache keys?
Calling Git Binary From Python And Error Codes
8,954,535
1
0
220
0
python,git,bash
Yes, git (and any well-behaved *nix program) will always return 0 for success and non-zero for failure. This is the paradigm on GNU/Linux systems, and since Git was made by the same person who made Linux, you can bet it follows the convention.
0
1
0
1
2012-01-21T15:58:00.000
1
1.2
true
8,954,383
0
0
0
1
I am trying to build a set of git utilities with python. I am using subprocess.Popen to run the git binary. Right now I am just trying to find the best way to determine that there was an error in running a git command. My question is whether or not git will always return a returncode of 0 on a successful git command and always return a returncode of non-zero on a unsuccessful call? I just want to make sure that checking the returncode is a safe way to detect an error so that I can exit the script if a git command was unsuccessful.
Python 2.7 doesn't look for .so libs in $LD_LIBRARY_PATH (OpenSUSE 12.1 x64)
8,956,663
4
0
693
0
python,ld,cython,opensuse
Use PYTHONPATH instead of LD_LIBRARY_PATH.
0
1
0
0
2012-01-21T19:01:00.000
1
0.664037
false
8,955,778
0
0
0
1
Got a problem with my project on OpenSUSE 12.1: somehow it ignores the path to libs provided in $LD_LIBRARY_PATH. The structure of calls is as follows: My python module adds the path to libs to $LD_LIBRARY_PATH, then imports cython module (interface.so) depending on some other corefuncs.so file. It worked fine on Ubuntu 11.04. Now it starts loading the cython module, but then throws an ImportError: corefuncs.so: no such file or directory. I can solve the problem by modifying /etc/ld.so.conf and running ldconfig, but can not make Python search through $LD_LIBRARY_PATH, modified within a terminal session. Are there any suggestions? Thanks!
Read values from a running program
8,964,345
0
1
289
0
c++,python,c,windows,io
You can use pipe. prgm.exe | anotherprogram.exe Just remember that the anotherprogram will get the whole output of prgm.exe
0
1
0
0
2012-01-22T20:15:00.000
5
0
false
8,964,315
1
0
0
1
In a DOS .exe program (with no access to source code), the DOS screen says: rate = 60. (or some other value). How do I read the output "60" to use as input to an application I'm making in Python or C/C++, other than by reading and typing it (I want to run it dozens of times). This program runs in Windows XP mode.
client connection id passed from nginx to uwsgi
8,978,823
0
3
475
0
python,http,nginx,wsgi,uwsgi
Two solutions come to mind: Link client to IP address and/or other headers the client is sending; Upon first connection create a session ID and change all the links on the page to /link/to/page?sid=%(sessionid)s. It's not very pretty but it works.
0
1
0
0
2012-01-23T21:12:00.000
1
0
false
8,978,653
0
0
0
1
I am using the following setup: client -> Nginx -> uWSGI -> Python app The connection between the client and Nginx is persistent. I am aware that there is no support for persistent connection between Nginx and uWSGI. Is there a way to pass the Nginx connection ID to uWSGI so I can differentiate between clients? I am trying to differentiate between clients with the following limitation: The client does not support cookies and I cannot modify the client code. The client posts some JSON to the same URL so modifying the URLs does not apply here.
App Engine Blobstore download all blobs at once
8,981,549
5
2
578
0
python,google-app-engine,blobstore
No, there's no way to do this. The blobstore can be aribrarily large, far larger than is practical to download in a single file.
0
1
0
0
2012-01-24T01:42:00.000
4
0.244919
false
8,981,103
0
0
1
3
I would like to download all blobs as a single zipped file (or another way) to my computer. Anyway to do that? I use the python SDK.
App Engine Blobstore download all blobs at once
8,993,546
1
2
578
0
python,google-app-engine,blobstore
It's probably better to download them one at a time anyway. That way if your job dies part way through you can restart for where it failed rather than starting over again from scratch.
0
1
0
0
2012-01-24T01:42:00.000
4
0.049958
false
8,981,103
0
0
1
3
I would like to download all blobs as a single zipped file (or another way) to my computer. Anyway to do that? I use the python SDK.
App Engine Blobstore download all blobs at once
9,376,684
-1
2
578
0
python,google-app-engine,blobstore
How about copy the blobs to google storage and then use gsutil to download the blobs from there?
0
1
0
0
2012-01-24T01:42:00.000
4
-0.049958
false
8,981,103
0
0
1
3
I would like to download all blobs as a single zipped file (or another way) to my computer. Anyway to do that? I use the python SDK.
ctypes - does python need to be compiled with same version as C library?
8,989,530
0
2
337
0
python,ctypes
CPython doesn't contain C++ code and thus there is no requirement with regards to the C++ compiler used to compile a C++ library loaded into a CPython process. However, the C layer and the C++ library must generally be compiled with the same C++ compiler. And if the C++ library or the C layer link against libpython, they must be compiled against the same version of CPython that is later used to run the ctypes code that loads the library.
1
1
0
0
2012-01-24T15:22:00.000
2
0
false
8,989,328
1
0
0
2
I'm running into some really weird problems with ctypes. I'm using ctypes to interface to a C++ library that has a C interface. The library has lots of parallel functionality. More often than not, the parallel calls tend to end up with a segfault from the C++ layer, but I've run into them with some serial code too. I'm wondering if there is any restriction on whether the Python interpreter and the C++ code need to be compiled with the same version of the C++ compiler? If so, how do I find out what c++ was used to build Python? I've tried to run strings on Python and grep for gcc and g++, nothing shows up.
ctypes - does python need to be compiled with same version as C library?
8,989,579
4
2
337
0
python,ctypes
There's no requirement at all that the native library that you call with ctypes has to be built with a matching runtime. In fact there's not even a requirement that the native library even uses a C runtime. For example you can use ctypes to call code written in other languages, e.g. Delphi. Or you can use ctypes to call Windows API functions which are not linked against MSVC. I guess you'll have to look elsewhere to resolve your problem!
1
1
0
0
2012-01-24T15:22:00.000
2
1.2
true
8,989,328
1
0
0
2
I'm running into some really weird problems with ctypes. I'm using ctypes to interface to a C++ library that has a C interface. The library has lots of parallel functionality. More often than not, the parallel calls tend to end up with a segfault from the C++ layer, but I've run into them with some serial code too. I'm wondering if there is any restriction on whether the Python interpreter and the C++ code need to be compiled with the same version of the C++ compiler? If so, how do I find out what c++ was used to build Python? I've tried to run strings on Python and grep for gcc and g++, nothing shows up.
Parser for command line parameters in Java/C/C++/Python/shell
8,993,917
1
4
393
0
java,python,c,parsing,command-line
getopt is also usable in Python and shell. Python has the argparse module, which is much easier to use (particularly for more complex argument parsing), but if you want consistency across all those languages, I don't know of any better option than getopt. If Java doesn't have a getopt implementation, you could possibly write one yourself without too much effort.
0
1
0
1
2012-01-24T18:31:00.000
1
1.2
true
8,992,077
0
0
1
1
I am looking for a library to parse command-line parameters that would work identically in Java, C/C++, Python and (preferably) shell. By "identical" I mean (1) have exactly the same rules for parsing of the parameters in all three languages, (2) use the same configuration files or have similar API to specify the parameters, (3) have similar APIs to access the values of the parameters. I've always used getopt in C and Apache CLI in Java but it would be nice to use the same specification for the parameters across multiple languages.
Install Python 3.2.2 on Mac OS X 10.6.8
9,024,848
0
0
1,804
0
python,macos,installation
No side effects, you can also use alias python3="/directory/where/python_binary" to get python3 as an shortcut to real python binary.
0
1
0
0
2012-01-26T17:44:00.000
2
0
false
9,022,723
1
0
0
2
I have Python 3.2.2 downloaded and have been using IDLE to execute code; however, I was wondering whether it is possible to have Python 3.2.2 run through Terminal as opposed to Python 2.6.1 on which it is currently running. How would I got about doing so? Would there be any bad side effects?
Install Python 3.2.2 on Mac OS X 10.6.8
9,022,756
0
0
1,804
0
python,macos,installation
Sure, start the terminal and type python3.2. That should get you into a Python 3.2 shell.
0
1
0
0
2012-01-26T17:44:00.000
2
1.2
true
9,022,723
1
0
0
2
I have Python 3.2.2 downloaded and have been using IDLE to execute code; however, I was wondering whether it is possible to have Python 3.2.2 run through Terminal as opposed to Python 2.6.1 on which it is currently running. How would I got about doing so? Would there be any bad side effects?
psycopg2 on Fedora
9,023,190
12
8
5,081
0
python,postgresql,fedora,psycopg2
You are probably searching python-devel and postgresql-devel packages.
0
1
0
0
2012-01-26T18:01:00.000
1
1.2
true
9,022,943
0
0
0
1
I'm trying to install psycopg2, using pip, on Fedora. I get the message: "pg_config executable not found." In ubuntu, this problem can be resolved by installing the libpq-dev and python-dev packages. There's no clear analogous solution in Fedora.
Partitioning a file for parallel download
9,030,620
0
2
113
0
python,floating-point,numbers,int,division
Special case the last thread -- assign it to get however many bytes are left.
0
1
0
0
2012-01-27T08:23:00.000
3
0
false
9,030,601
1
0
0
1
I want to make a multi-threaded downloader (in Python) and I need to tell each thread where to start and how many bytes to download. For that I get the remote file size and divide it, for example, to 2. Now, let's say that the remote file size is 5: when I divide the number to 2, I get 2 as result. Now I can start the download but I will lose a byte (because 2*2=4, not 5). I can't use float numbers because I can't download half of a byte. How I could divide that number and to get a list with [2, 3], for example?
Python run .py in separate windows (Windows 7, Python 2.6.6 64-bit)
9,034,986
0
1
390
0
python,cmd
You can run it through IDLE, the built-in editor. It may not be much helpful if you have to provide command-line args. An alternate option may be making the code wait for a keypress using raw_input(), as Insidi0us said. You can also print the errors to a file. Another option may be running the command prompt first, then run python command (make sure your environment variable contains the python installation directory).
0
1
0
0
2012-01-27T14:31:00.000
3
0
false
9,034,799
1
0
0
2
I have no idea why python run every script in a new command window. For example I run: python testfile.py, it is show new window and close immediately, so I can't look the traceback. Python 2.7 32-bit at the same machine works normally
Python run .py in separate windows (Windows 7, Python 2.6.6 64-bit)
9,034,871
0
1
390
0
python,cmd
Did you try adding raw_input() at the end of testfile.py ?
0
1
0
0
2012-01-27T14:31:00.000
3
0
false
9,034,799
1
0
0
2
I have no idea why python run every script in a new command window. For example I run: python testfile.py, it is show new window and close immediately, so I can't look the traceback. Python 2.7 32-bit at the same machine works normally
Cross-platform alternative to py2exe
9,036,282
4
15
29,961
0
python,py2exe
I really doubt that you can do something like that at all. What you could do is just configure yourself 3 build VMs one for Windows, one for MacOS and one for Linux that have everyhing you need to run your program. Then use either a combination of py2exe/py2app/pyinstaller to generate a distribution for each of the platforms. You will have 3 different pacakges but each one of them will be nicely packed and with no need to install anything else on the client machines.
0
1
0
0
2012-01-27T15:09:00.000
3
0.26052
false
9,035,424
1
0
0
1
py2exe is great, and I use it whenever I want to package up a python program to run on a Windows system. My question is, is there an equivalent tool that I can use to package up the program on Windows, but that I can then run on Linux?
Calling MPI_Init more than once
9,053,423
1
0
1,657
0
python,pthreads,mpi
If I understand you correctly, the easiest way would be to intercept the calls to MPI_Init and execute it only once. For C, MPI provides the PMPI Profiling Interface that allows you to override any MPI symbol and provides an additional PMPI symbol. E.g. you define a function MPI_Init and in that function, depending if it is called for the firs time, call PMPI_Init. The same (in reverse) for MPI_Finalize. I am not sure about the most elegant way to do that in Python. I assume you could just hack into the python bindings or LD_PRELOAD a simple C library doing the magic. All of that is just a workaround, that might have bad side effects. MPI Implementations advise you to not do much before an MPI_Init. The real solution would be fixing the code to use MPI appropriately.
0
1
0
0
2012-01-27T16:22:00.000
1
1.2
true
9,036,584
1
0
0
1
I understand that MPI_init can only be called more than once per executable instance. Can anyone clarify the limits of this language: ie: I know multiple python exec on mpiexec can be run. Is there anything like fork() or threads that can lead to something that qualifies? Is the criterion that they have to happen first and then invoke mpiexec? Thanks!
Making Python scripts run on Windows without specifying ".py" extension
49,847,281
-1
28
19,958
0
python,windows,windows-7
Create a file named 'personalisedCommand.cmd' in a path folder with this inside: @echo off python absolute/path/to/pythonScript
0
1
0
0
2012-01-27T17:17:00.000
4
-0.049958
false
9,037,346
1
0
0
1
I want to able to open a command prompt at the folder which contains a python script and just type in the script name without the .py and watch it run. Following the various tips on google to do this, I do: Add the python.exe to my path Add .py to PATHEXT Try to open the .py file in windows explored. When prompted with: What program do you want to open this? I navigate to my python.exe What should happen is the python.exe should be added to the 'Open With' pop up, but it is not? I re try with the python.exe off my path. Same problem. Note every time I set a path it is in the control panel. Version of python is 2.7. And to make things stranger, I can associate .py programs with pythonw - but this is no use, as I want the console. Any help appreciated.