Q_Id
int64
337
49.3M
CreationDate
stringlengths
23
23
Users Score
int64
-42
1.15k
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
Tags
stringlengths
6
105
A_Id
int64
518
72.5M
AnswerCount
int64
1
64
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
6
11.6k
Available Count
int64
1
31
Q_Score
int64
0
6.79k
Data Science and Machine Learning
int64
0
1
Question
stringlengths
15
29k
Title
stringlengths
11
150
Score
float64
-1
1.2
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
8
6.81M
11,439,682
2012-07-11T19:06:00.000
1
0
1
0
python,semaphore
12,600,687
3
false
0
0
You should definitely not try to peek into the counter value of the semaphore. Doing this breaks the abstraction of the semaphore. Moreover the value that you read may not even be the correct value because, one - there might be another thread that could change the value of the count before you can actually make use of ...
1
6
0
I have a bounded semaphore object that ensures my program doesn't download more than a certain number of files at a time. Each worker thread acquires the semaphore when it starts downloading and releases it when done. I have another thread that would like to run code when nothing is being downloaded. I would like a me...
how to tell if a semaphore is full in python
0.066568
0
0
4,915
11,441,546
2012-07-11T21:11:00.000
3
0
1
1
python,virtualenv,apt-get
53,515,591
5
false
0
0
An alternative solution is to install globally, then followed by allowing the virtualenv to be able to see it. As an example, let's say we want to install matplotlib for Python 3: sudo apt update # Update first sudo apt install python3-matplotlib # Install globally sudo pip3 install -U virtualenv # Install virtualen...
1
30
0
It it's possible, of course. For example - I can download python-dbus like this: $ sudo apt-get download python-dbus But what I should to do next, with this .deb package in my current virtualenv?
How I can make apt-get install to my virtualenv?
0.119427
0
0
30,665
11,442,080
2012-07-11T21:53:00.000
2
0
1
0
python,memory
11,512,250
1
false
0
0
You have an application which has a data structure that appears to require 16GB+ of RAM, right? If so, then limiting its RAM will cause the application to fail, will it not? Is there a reason all of this data needs to be in RAM all at once? Likely, the application could be redesigned to take up less than 16GB of RAM ...
1
4
0
I have a system with 16GB of memory. I run a python script for some data mining application and the process takes up the entire 16GB. I want to limit the python process to take up only a limited amount of memory. Is it possible to do this? If yes, how? Update: The application retrieves hotel review data from a huge da...
Limit Python process memory usage
0.379949
0
0
2,718
11,442,944
2012-07-11T23:18:00.000
0
0
0
1
python,for-loop,subprocess
20,869,726
2
false
0
0
A common way to detect things that have stopped working is to have them emit a signal at roughly regular intervals and have another process monitor the signal. If the monitor sees that no signal has arrived after, say, twice the interval it can take action such as killing and restarting the process. This general idea ...
2
2
0
I am running an os.system(cmd) in a for-loop. Since sometimes it hangs, I am trying to use process=subprocess.pOpen(cmd) in a for-loop. But I want to know the following: If I do sleep(60) and then check if the process is still running by using process.poll(), how do I differentiate between process actually running eve...
python handling subprocess
0
0
0
144
11,442,944
2012-07-11T23:18:00.000
4
0
0
1
python,for-loop,subprocess
11,443,356
2
true
0
0
I don't know of any general way to tell whether a process is hung or working. If a process hangs due to a locking issue, then it might consume 0% CPU and you might be able to guess that it is hung and not working; but if it hangs with an infinite loop, the process might make the CPU 100% busy but not accomplish any us...
2
2
0
I am running an os.system(cmd) in a for-loop. Since sometimes it hangs, I am trying to use process=subprocess.pOpen(cmd) in a for-loop. But I want to know the following: If I do sleep(60) and then check if the process is still running by using process.poll(), how do I differentiate between process actually running eve...
python handling subprocess
1.2
0
0
144
11,443,550
2012-07-12T00:35:00.000
2
0
1
0
c#,python.net
11,445,596
2
true
0
0
After some more poking around I found out two things: Changing the build target to x86 solved the missing DLL error, however the application still cryptically crashed when calling PythonEngine.Initialize(). I was able to solve this by making sure that the initialization takes place before any other code is executed.
2
2
0
I'm using .net framework 4.5 but have had the same result with 4.0: If I write a bare bones console application to initialize python.net, it works as expected. If I try to do the same thing from a winforms application, I get "Unable to load DLL 'python27': The specified module could not be found. (Exception from HRESUL...
python.net: Unable to load python27.dll with winforms but console application works
1.2
0
0
2,456
11,443,550
2012-07-12T00:35:00.000
0
0
1
0
c#,python.net
55,565,415
2
false
0
0
I added reference to python.runtime.dll (which is located in xxx\Python36\Lib\site-packages) to solve the dll loading problem. I changed the build target to x64 solved my PythonEngine.Initialize() problem. And @Bicubic solved his problem by changing to x86. So you just can not let the c# target to be AnyCPU. Try both. ...
2
2
0
I'm using .net framework 4.5 but have had the same result with 4.0: If I write a bare bones console application to initialize python.net, it works as expected. If I try to do the same thing from a winforms application, I get "Unable to load DLL 'python27': The specified module could not be found. (Exception from HRESUL...
python.net: Unable to load python27.dll with winforms but console application works
0
0
0
2,456
11,444,173
2012-07-12T02:15:00.000
0
1
0
0
python,python-c-api
11,444,316
2
false
0
0
I found out the answer. I was mistaken, and I thought there were doubles in Python, but there aren't. I got it to work using a "PyFloat" object, and just converted the double like this: "PyFloat_FromDouble([the double I wanted as a PyObject])"
1
1
0
So I'm writing a set of C++ classes that run Python scripts. I've gotten code working to run any script I want from a specified directory, and I can pass and return values just fine. But the one issue I have is I can't seem to find out how to set Python doubles up. For example, when I was using long values, I could us...
doubles in embedded python
0
0
0
73
11,444,245
2012-07-12T02:26:00.000
6
0
1
1
python,windows,pyflakes
16,672,834
3
false
0
0
Maybe this question is a bit old, because running "pip install pyflakes" worked flawlessly on Windows to me...
1
4
0
Having trouble getting pyflakes to run on windows. On Windows there is no apt install , so... what to do?
How can I get pyflakes to run on Windows?
1
0
0
5,388
11,445,143
2012-07-12T04:47:00.000
1
0
0
0
python,ios,django,apple-push-notifications
11,471,280
1
false
1
0
Never mind, I tried it again using an absolute file path, and it worked after I restarted Django.
1
1
0
I'm using Django to send iOS push notifications. To do that, I need to access a .pem certificate file currently stored on the server in my app directory along with views.py, models.py, admin.py, etc. When I try to send a push notification from a python shell on the server, everything works fine. But when I try to se...
Django Access File on Server
0.197375
0
0
846
11,445,815
2012-07-12T06:01:00.000
0
0
0
0
python,django,localization,internationalization,timezone
11,445,895
2
false
1
0
Time zones is rather simple to implement. Simply use pytz and/or dateutil. Your question is quite broad, can you give an example of specific language issues you're facing?
1
3
0
This is quite different question. We have a django web application in an European language. Now we want same app in English language. I guess if I just follow the django internalization/localization steps in reverse order, I will be able to make the app in English (The original code was written by someone else). But I...
Django reverse internalization/localization
0
0
0
302
11,453,316
2012-07-12T13:50:00.000
6
0
1
0
python,buildout,egg
11,453,371
1
true
0
0
Very simple: Parts are the building blocks of your buildout. Different parts run different tasks, based on the recipe that is declared for them and the settings configured in that part. The parts subdirectory hold the bookkeeping information for each part. It depends on the recipe what is stored here. A CMMI recipe mi...
1
3
0
There is 2 directories when you work with buildout: eggs and parts. Also there are declarations of eggs and parts in buildout.cfg. What is purpose of those elements of buildout system?
What is difference in buildout between eggs and parts?
1.2
0
0
151
11,453,698
2012-07-12T14:09:00.000
1
0
1
0
python,vpython
11,484,890
1
false
0
0
FYI: I resolved this myself by creating a composite object (a box and several text objects) within a frame, then spinning the frame.
1
0
0
I am new to Python/Vpython and would appreciate some guidance. What is the best means to create a vpython box (or 3D rectangle, etc..) with a unique text string on each face of the box such that when the box rotates, the text will rotate as well. A simple way to envision this program would be similar to a dice roll, w...
Vpython 3D Box+Text combination
0.197375
0
0
414
11,455,969
2012-07-12T16:05:00.000
0
0
0
0
python,google-app-engine,text,properties
11,497,014
1
false
1
0
Have your computed property return an instance of db.Text instead of a String. As Wooble points out, though, there's absolutely no point in doing this: the computed property exists to aid indexing, and if you're not indexing the data, you may as well use a regular property and not store it in the datastore at all.
1
1
0
I am kind of new to GAE and I was trying to use @db.ComputedProperty to dynamically add field values However I am getting the error message Property xxxx is 721 bytes long; it must be 500 or less. Consider Text instead, which can store strings of any length. It seems that @db.ComputedProperty defaults to StringProperty...
Change db.ComputedProperty from StringProperty to TextProperty
0
0
0
156
11,458,969
2012-07-12T19:13:00.000
4
0
0
1
python,django,google-app-engine,webapp2
11,460,359
3
false
1
0
The short answer is you can probably go either way, there will be some pros/some cons, but I don't think either is pure win. Here's some pros for using Django-nonrel as a newb: The django docs are generally pretty good. So it helps you get up to speed on some best practices CSRF protection Form validation sessions au...
1
0
0
I started web development 2 weeks ago using GAE,WebApp2,Jinja2 and WTForms. I read though several articles , discussions , watched lessons about web development with gae (udacity) and started a small project. Now I am very inexperienced in web-development and I don't know which path i should choose. . . The last few da...
Google App Engine - Choosing the right direction
0.26052
0
0
2,564
11,460,115
2012-07-12T20:28:00.000
5
0
0
0
python,nlp,nltk
11,462,417
1
true
0
0
NLTK classifiers can work with any key-value dictionary. I use {"word": True} for text classification, but you could also use {"contains(word)": 1} to achieve the same effect. You can also combine many features together, so you could have {"word": True, "something something": 1, "something else": "a"}. What matters mos...
1
2
1
In NLTK, using a naive bayes classifier, I know from examples its very simply to use a "bag of words" approach and look for unigrams or bigrams or both. Could you do the same using two completely different sets of features? For instance, could I use unigrams and length of the training set (I know this has been mentione...
NLTK multiple feature sets in one classifier?
1.2
0
0
1,502
11,460,864
2012-07-12T21:20:00.000
0
0
0
0
python,wxpython,wxwidgets
11,471,540
1
true
0
0
I think all you have to do is change the font size of the item. That's what it looks like in the wxPython demo anyway. You could ask on the wxPython users group though. The author of that widget is on there most of the time and is very helpful.
1
0
0
I gave my CustomTreeCtrl the TR_HAS_VARIABLE_ROW_HEIGHT style. But I am not sure where to go from there to change the height of the items inside the tree. I cant really find anything on the API or online.
how to use CustomTreeCtrl with the TR_HAS_VARIABLE_ROW_HEIGHT style to change the items height?
1.2
0
1
138
11,462,291
2012-07-12T23:44:00.000
0
0
0
1
python,django,sqlite,google-app-engine,google-cloud-storage
11,498,320
3
true
1
0
No. SQLite requires native code libraries that aren't available on App Engine.
2
1
0
since it is not possible to access mysql remotely on GAE, without the google cloud sql, could I put a sqlite3 file on google cloud storage and access it through the GAE with django.db.backends.sqlite3? Thanks.
Google App Engine + Google Cloud Storage + Sqlite3 + Django/Python
1.2
1
0
2,078
11,462,291
2012-07-12T23:44:00.000
0
0
0
1
python,django,sqlite,google-app-engine,google-cloud-storage
11,463,047
3
false
1
0
Google Cloud SQL is meant for this, why don't you want to use it? If you have every frontend instance load the DB file, you'll have a really hard time synchronizing them. It just doesn't make sense. Why would you want to do this?
2
1
0
since it is not possible to access mysql remotely on GAE, without the google cloud sql, could I put a sqlite3 file on google cloud storage and access it through the GAE with django.db.backends.sqlite3? Thanks.
Google App Engine + Google Cloud Storage + Sqlite3 + Django/Python
0
1
0
2,078
11,463,081
2012-07-13T01:50:00.000
1
0
1
0
python,nltk
11,468,347
1
false
0
0
What you're probably trying to do is read your own file using the nltk software. If you have a directory /home/me/corpusdir with files in ieer format, you should be able to open them with myreader = nltk.corpus.reader.ieer.IEERCorpusReader(r'/home/me/corpusdir', '*.txt') You can then call the same methods as on the re...
1
0
0
I am to new to NLTK and Python. How do I add or upload our own file to nltk corpus? For example, how could I upload my own .TXT file to ieer corpus? Is it possible? Thanks.
How to add or upload file to nltk corpus?
0.197375
0
0
889
11,464,345
2012-07-13T04:55:00.000
0
0
1
0
python
11,464,623
3
false
0
0
value='A 0006 005C 0078 0030 0034 0046 0030 00' value[1:-2-1] You will get the result as ' 0006 005C 0078 0030 0034 0046 0030'
1
1
0
How to remove first and last using python value=A 0006 005C 0078 0030 0034 0046 0030 00
How to remove first item and last item using python
0
0
0
1,128
11,464,608
2012-07-13T05:25:00.000
0
0
0
0
python,tkinter
11,473,405
3
false
0
1
I think this is due to the fact you've given the entry widget a specific width (or are accepting the default). Since the widget wants to be a particular size, it will cause the column to grow in order to fit the requested size of its children. One solution is to set the size of the entry widget to 1. Then, because of ...
2
0
0
I am using the grid manager and have two frames side by side, and five columns with 1 button in each below the two frames in a second row, evenly spaced. All use "sticky" NSEW since I want them to scale proportionally if I enlarge the window. When I add a text entry widget to the right frame, it distorts the buttons be...
Tkinter - text widget distorting column sizes
0
0
0
2,171
11,464,608
2012-07-13T05:25:00.000
0
0
0
0
python,tkinter
11,470,343
3
false
0
1
In each frame you should set the "propagate" status to false, this will keep the frame from resizing based on what is inside. So if the frame uses grid() set grid_propagate(False) and so on.
2
0
0
I am using the grid manager and have two frames side by side, and five columns with 1 button in each below the two frames in a second row, evenly spaced. All use "sticky" NSEW since I want them to scale proportionally if I enlarge the window. When I add a text entry widget to the right frame, it distorts the buttons be...
Tkinter - text widget distorting column sizes
0
0
0
2,171
11,466,604
2012-07-13T08:13:00.000
0
0
0
0
python,tabular
11,466,876
3
false
0
0
While I really think you should code this up in python for the sake of learning python, if all you want is to get it done, try using Excel! read in the table (I'd be surprised if Excel can't figure this out!) delete the columns you're not interested in export / saveas fixed width
1
4
0
I'm by no means a programmer but I stumbled over a really nasty fixed width ASCII table which might require me to become one :) (with some help from you guys I hope) I did already ask Mr. Google for some advice and he pointed my in the direction of Python. So here I am - pretty lost :( The offending table looks like th...
Extracting only interesting columns from ASCII table
0
0
0
2,437
11,470,856
2012-07-13T12:49:00.000
2
0
0
0
python,rest,http-status-codes
11,470,884
1
true
0
0
Use an existing web framework such as Flask or Django. Doing this by yourself with sockets is way too much work, it's not worth it.
1
2
0
I want to make very simple application in Python which: When REST calls PUT/DEL/GET are recived than response code is 200 When REST call create is recived than response code is 201 I tried with sockets but I don't know how to send 201.
Recive REST and Response http codes in Python
1.2
0
1
81
11,472,810
2012-07-13T14:45:00.000
2
0
1
0
python,setuptools
55,708,951
5
false
0
0
Another way to it is to use wildcards. This does not apply to >= 0.5.0, < 0.7.0, but in case you decide that all maintenance releases should be supported (e.g. 0.5.0 to 0.5.x), you can use == 0.5.* e.g. docutils == 0.3.*
1
61
0
I want to make a package to depend the particular version range e.g. >= 0.5.0, < 0.7.0. Is it possible in install_requires option, and if so how should it be?
How to specify version ranges in install_requires (setuptools, distribute)
0.07983
0
0
21,786
11,472,843
2012-07-13T14:47:00.000
2
0
0
1
python,windows,path,cmd
67,924,065
4
false
1
0
I also had the same issue... I could fix it by re-associating *.py files with the python launcher. Right click on a *.py file and open its properties. Click on the Change button of the "Opens with..." section Select More apps -> Look for another app on this PC. Then browse to your windows folder (by default: "C:\Windo...
1
27
0
How do I have to configure so that I don't have to type python script.py but simply script.py in CMD on Windows? I added my python directory to %PATH% that contains python.exe but still scripts are not run correctly. I tried it with django-admin.py Running django-admin.py startproject mysite gives me Type 'django-admi...
Set up Python on Windows to not type "python" in cmd
0.099668
0
0
17,143
11,475,796
2012-07-13T17:56:00.000
0
0
1
0
python
11,475,854
5
false
0
0
The lines and words in the big file need to somehow be sorted, in which case you can implement binary search. It does not seem like they are so the best you can do is linear search by checking to see if each word in the list is in a given line.
1
3
0
I am new python. I have a list of words and a very large file. I would like to delete the lines in the file that contain a word from the list of words. The list of words is given as sorted and can be fed during initialization time. I am trying to find the best approach to solve this problem. I'm doing a linear search ...
Searching a list of words from a large file in python
0
0
0
475
11,475,925
2012-07-13T18:06:00.000
5
0
0
0
python,ironpython
11,476,423
1
true
0
1
There are a few reason why IronPython is slow to startup. First, if you didn't use the installer (which will ngen the assemblies), the JIT compiler has to convert the IronPython assemblies from MSIL bytecode to native code, and that takes time, as it's a lot of code. So use the installer on manually ngen the assemblies...
1
2
0
I am launching IronPython 2.7.3 on Windows 7 and it is taking more than 15 seconds. Why is it so slow? And how to fix it? The computer is a Samsung NP300E5A(Celeron B800,2gb) notebook.
IronPython launching very slowly
1.2
0
0
345
11,476,379
2012-07-13T18:39:00.000
0
0
1
0
python,types
11,476,411
7
false
0
0
7.0 is "better", no need for the cast to float, it will do it automatically. float() is best saved for casting a non-float to a float.
4
9
0
I'm curious which form is more efficient, is correct style, etc. I feel like the ".0" approach is much quicker; I'm not sure why the "float" approach is equally appreciated (if it is).
Is it less computationally intensive to use 7.0 or float(7) in Python?
0
0
0
795
11,476,379
2012-07-13T18:39:00.000
1
0
1
0
python,types
11,476,416
7
false
0
0
Float literals can be written as 7.0, that is fine as they are automatically of type float. If you intend to convert an integer or string to float then the float() function is appropriate but that function does not need to be called to write a float literal.
4
9
0
I'm curious which form is more efficient, is correct style, etc. I feel like the ".0" approach is much quicker; I'm not sure why the "float" approach is equally appreciated (if it is).
Is it less computationally intensive to use 7.0 or float(7) in Python?
0.028564
0
0
795
11,476,379
2012-07-13T18:39:00.000
0
0
1
0
python,types
11,476,594
7
false
0
0
7.0 should be faster. float(7) creates an integer, then call the float() function to convert the integer to a float, so calling float(7) implicates function call overhead as well as any error checking the float() function might do. For most practical purposes, of course, the difference in speed is unlikely to matter m...
4
9
0
I'm curious which form is more efficient, is correct style, etc. I feel like the ".0" approach is much quicker; I'm not sure why the "float" approach is equally appreciated (if it is).
Is it less computationally intensive to use 7.0 or float(7) in Python?
0
0
0
795
11,476,379
2012-07-13T18:39:00.000
0
0
1
0
python,types
11,476,424
7
false
0
0
Using float(0) is much more explicit when re-reading your code at a later date, causing less confusion later if you accidentally drop the ".0".
4
9
0
I'm curious which form is more efficient, is correct style, etc. I feel like the ".0" approach is much quicker; I'm not sure why the "float" approach is equally appreciated (if it is).
Is it less computationally intensive to use 7.0 or float(7) in Python?
0
0
0
795
11,477,067
2012-07-13T19:26:00.000
5
0
0
0
python,django,security,brute-force
11,477,465
3
false
1
0
You can: Keep track of the failed login attempts and block the attacker after 3 attempts. If you don't want to block then you can log it and present a CAPTCHA to make it more difficult in future attempts. You can also increase the time between login attempts after eached failed attempt. For example, 10 seconds, 30 sec...
1
30
0
Are there generally accepted tactics for protecting Django applications against this kind of attack?
Throttling brute force login attacks in Django
0.321513
0
0
18,059
11,477,308
2012-07-13T19:43:00.000
0
0
0
0
python,user-interface,pyqt4
11,477,562
1
false
0
1
QLabel is used to display texts while QTextEdit is mostly used to get one-line inputs of the user. e.g a form field to indicate that a name must be typed into the input area, QLabel is used as Name : and the QTextEdit is where the user will type in. But i think you should first check out layouts and placing methods o...
1
0
0
I am trying to make a GUI interface using PyQt4. I want to be able to send text from my python program and have it be displayed on a window created by PyQt4. I've been able to input data via a push button, but I would like to be able to write it from my python program. I can create a window using the self.setGeometr...
Displaying text in a window with PyQT4
0
0
0
3,600
11,478,690
2012-07-13T21:33:00.000
0
0
0
0
python,streaming,usb,emulation
11,478,774
1
false
0
0
This isn't possible without special hardware because USB doesn't support peer-to-peer networks. You might do better with Firewire (IEEE-1394), which can at least be used for TCP/IP with appropriate drivers.
1
0
0
I would like to know if the following is possible: I want to connect my computer to either another computer, or a some consumer electronics (like a ps3 or xbox or something), via a double sided USB cable. I want to run a program on the first computer that will run a constant data stream through the USB cable, to trick ...
Streaming data over USB in python / mimic usb drive with python?
0
0
1
988
11,479,025
2012-07-13T22:10:00.000
2
0
1
0
shell,user-interface,python-idle
13,106,149
1
false
0
0
I ran in to this today. Basically there was already an older version installed and installing over it (I think it was 2.7.2) with 2.7.3 64 bit broke it bad. At first the CLI python would work but IDLE refused to launch without even an error. Uninstalling/reinstalling did nothing several times, and the problems got ...
1
0
0
Have been running Python 2.7.2 for several months, was using the 32-bit version on my 64-bit computer. Today ran the installer for 2.7.3, 64-bit. Now I cannot get idle to start. I see answers here for Python in program files, I am running Win7, and I believe the correct location for this machine is in C:\, not in progr...
new python version, now cannot start idle
0.379949
0
0
1,386
11,479,978
2012-07-14T00:33:00.000
5
0
1
0
python
11,479,983
1
true
0
0
You want os.walk(). It will give you a list of files and folders in each directory under the starting directory.
1
0
0
I have been at this for a few hours... how to use python to get all enclosing files from a folder... now by enclosing I mean all the files enclosed within a folder within a folder etc. So all the files beyond a certain point using Python. I have tried to use glob.glob() and listdir() to do this, but those will just on...
Python get list of all enclosing files
1.2
0
0
104
11,484,029
2012-07-14T13:10:00.000
5
0
0
1
python,command-line,python-3.x
11,484,057
4
true
0
0
The argparse module from Python's standard library also supports commands, and it works in both, Python 2.x and 3.x.
1
2
0
I like the cmdln framework for writing programs that work like svn command argument but it only works in Python 2. What's a good Python 3 alternative?
Whats a good command-oriented commandline framework for Python 2 and 3?
1.2
0
0
530
11,485,610
2012-07-14T16:52:00.000
0
0
1
0
python,json,yajl
12,529,379
2
true
0
0
Thats an easy one, that is because you haven't installed the YAJL C library! ijson is a wrapper around the YAJL without it won't work.
2
1
0
I need to parse some large (2 Gb+) files into python. I have tried it with the json module but I get a memory error as its methods all load the files at once. I then moved on into installing ijson which suposedly implements a iterator-based way of parsing the file. However when I run: import ijson I get exception : YA...
error when importing ijson module python
1.2
0
0
1,026
11,485,610
2012-07-14T16:52:00.000
0
0
1
0
python,json,yajl
65,940,512
2
false
0
0
I installed it via Anaconda and suddenly it started working. Open Anaconda prompt (win search anaconda) run command: conda install ijson
2
1
0
I need to parse some large (2 Gb+) files into python. I have tried it with the json module but I get a memory error as its methods all load the files at once. I then moved on into installing ijson which suposedly implements a iterator-based way of parsing the file. However when I run: import ijson I get exception : YA...
error when importing ijson module python
0
0
0
1,026
11,486,922
2012-07-14T19:50:00.000
13
0
1
0
python,list,python-3.x,iteration
11,486,935
2
false
0
0
reversed should be best as it returns an iterator, so it doesn't copy the list, just yields one element at a time. (list.reverse() also will not copy the list, but it will mutate it, so the list will be backwards after you're done, whereas reversed doesn't modify the original list.)
1
8
0
I'm using Python 3.2.3. What's the fastest way to iterate over a list in reverse? [::-1], reversed, list.reverse() or maybe some other way? I'm dealing with a list of about 5e6 elements or so, so I really need to avoid copying the list.
Need to iterate over a Python list in reverse as fast as possible
1
0
0
7,961
11,487,954
2012-07-14T22:45:00.000
2
0
0
0
python,eclipse,pydev
11,488,572
2
true
1
0
This was originally a comment on the OP, but turned out to be the correct answer, so I'm reposting. The setting to replace tabs with spaces exists in two places in eclipse: General > Editors > Text Editors Pydev > Editor Both these settings need to be set correctly in order to solve this problem as they can override ...
1
1
0
I'm editing django files in Eclipse Indigo with pydev. Suddenly in one file, eclipse has decided to start using four spaces instead of tabs. The file has a .py extension. It's fine in other files, it's just this one that it's having trouble with. The settings are correct for using tabs. I've tried closing and reop...
Eclipse randomly replacing tabs with spaces
1.2
0
0
166
11,488,487
2012-07-15T00:35:00.000
0
0
0
0
python,tkinter
11,491,757
2
false
0
1
Yes, a handler for a button (or any event) can modify any widget in any other toplevel. As long as that handler has a reference to the widget, the handler can modify it. There are no restrictions in that regard.
1
0
0
If I have a button that executes a handler in relation to one toplevel window or root - can it modify a widget in another toplevel? What is the standard method of doing this?
Tkinter toplevel communication
0
0
0
463
11,489,481
2012-07-15T04:41:00.000
1
0
1
1
python,patch,ubuntu-12.04
11,489,520
2
false
0
0
Unless you are running a custom-compiled version of Python that you pulled from the cvs server (which I'm pretty sure you are not), the best thing to do is to wait until an official build is provided by the Ubuntu packagers. Also, since this bug was found on Apr 19, 2012 and hasn't been bundled into Python 2.7's tarbal...
2
1
0
I am using Ubuntu 12.04 LTS; python 2.7.3 is pre-installed. A bug in python 2.7 distribution has been fixed in their repository. changeset 76420:ab9d6c4907e7 2.7 How do I apply this patch on my PC ? Thanks, Vineet
python patch : how to apply
0.099668
0
0
3,549
11,489,481
2012-07-15T04:41:00.000
1
0
1
1
python,patch,ubuntu-12.04
11,489,496
2
true
0
0
You can use the mercurial equivalents of following comands: svn log svn diff patch The "hg" equivalents of the first two commands will identify all the files that have changed and the the changes in them. The last command will apply the patches. Use the man command to get detailed usage information on the commands.
2
1
0
I am using Ubuntu 12.04 LTS; python 2.7.3 is pre-installed. A bug in python 2.7 distribution has been fixed in their repository. changeset 76420:ab9d6c4907e7 2.7 How do I apply this patch on my PC ? Thanks, Vineet
python patch : how to apply
1.2
0
0
3,549
11,490,038
2012-07-15T06:48:00.000
4
0
1
0
c++,python,floating-point
11,490,403
2
true
0
0
Contra Thomas's answer, floating point operations are not non-deterministic. They are fiendishly subtle, but a given program should give the same outputs for the same inputs, if it is not using uninitialized memory or deliberately randomized data. My first question is, what do you mean by "the same data"? How is that ...
1
5
0
Without getting into unnecessary details, is it possible for operations on floating-point numbers (x86_64) to return -however small- variations on their results, based on identical inputs? Even a single bit different? I am simulating a basically chaotic system, and I expect small variations on the data to have visible ...
floating point processor non-determinism?
1.2
0
0
1,957
11,491,089
2012-07-15T10:11:00.000
0
0
0
0
python,django,e-commerce,satchmo
12,105,661
1
false
1
0
You can listen to satchmo_store.shop.signals.order_success and include in your listener all the required steps for self subscription (user to group, object creation etc.,..).
1
0
0
I'm trying to set up Satchmo, and I found this cool Subscription Product, but what I want is make a members-only section on the site (a multiple store website) itself. In other words, I want the users to make subscriptions to be able to use certain features. Is this possible in Satchmo? I guess if my website is called ...
Use Satchmo subscription to the store itself
0
0
0
118
11,491,529
2012-07-15T11:34:00.000
0
0
0
0
python,django,django-admin
58,411,790
10
false
1
0
If you had your server running till one point and a certain action/change broke it, try going back to the previous state. In my case there was an email trigger which would put the system in an invalid state if email doesn't go through. Doing git stash followed by selectively popping the stash and trying the runserver h...
4
5
0
I'm new to django and currently going through the main tutorial. Even though it was working earlier, when I do python manage.py runserver OR python manage.py -h OR with any other command, the shell doesn't output anything. Wondering what I'm doing wrong.
Nothing happens when I do: python manage.py command
0
0
0
14,807
11,491,529
2012-07-15T11:34:00.000
1
0
0
0
python,django,django-admin
61,670,225
10
false
1
0
Please try this. Uninstall Python. Go inside C drive and search Django. You will get many Django related files. Delete every Django file. don't delete your Django files. Install Python. It's worked for me.
4
5
0
I'm new to django and currently going through the main tutorial. Even though it was working earlier, when I do python manage.py runserver OR python manage.py -h OR with any other command, the shell doesn't output anything. Wondering what I'm doing wrong.
Nothing happens when I do: python manage.py command
0.019997
0
0
14,807
11,491,529
2012-07-15T11:34:00.000
0
0
0
0
python,django,django-admin
63,147,601
10
false
1
0
if you are using Redis Server on Windows, check it out if Redis Server is running, I had same problem and realized my Redis Server was not running, I ran it and now my manage.py commands work fine.
4
5
0
I'm new to django and currently going through the main tutorial. Even though it was working earlier, when I do python manage.py runserver OR python manage.py -h OR with any other command, the shell doesn't output anything. Wondering what I'm doing wrong.
Nothing happens when I do: python manage.py command
0
0
0
14,807
11,491,529
2012-07-15T11:34:00.000
0
0
0
0
python,django,django-admin
63,864,484
10
false
1
0
The same happened with me also, but this issue is a minor one as it happens if you have multiple versions of Python on your system, you can select a specific Python version by running python3 or whichever version you want. SO you should start from the beginning, uninstall Django first then, create a virtual environment...
4
5
0
I'm new to django and currently going through the main tutorial. Even though it was working earlier, when I do python manage.py runserver OR python manage.py -h OR with any other command, the shell doesn't output anything. Wondering what I'm doing wrong.
Nothing happens when I do: python manage.py command
0
0
0
14,807
11,497,376
2012-07-16T02:14:00.000
4
0
1
0
python,line-breaks,file-writing
11,497,399
15
false
0
0
Most escape characters in string literals from Java are also valid in Python, such as "\r" and "\n".
3
410
0
In comparison to Java (in a string), you would do something like "First Line\r\nSecond Line". So how would you do that in Python, for purposes of writing multiple lines to a regular file?
How do I specify new lines on Python, when writing on files?
0.053283
0
0
2,399,304
11,497,376
2012-07-16T02:14:00.000
6
0
1
0
python,line-breaks,file-writing
11,497,389
15
false
0
0
The same way with '\n', though you'd probably not need the '\r'. Is there a reason you have it in your Java version? If you do need/want it, you can use it in the same way in Python too.
3
410
0
In comparison to Java (in a string), you would do something like "First Line\r\nSecond Line". So how would you do that in Python, for purposes of writing multiple lines to a regular file?
How do I specify new lines on Python, when writing on files?
1
0
0
2,399,304
11,497,376
2012-07-16T02:14:00.000
10
0
1
0
python,line-breaks,file-writing
11,497,390
15
false
0
0
In Python you can just use the new-line character, i.e. \n
3
410
0
In comparison to Java (in a string), you would do something like "First Line\r\nSecond Line". So how would you do that in Python, for purposes of writing multiple lines to a regular file?
How do I specify new lines on Python, when writing on files?
1
0
0
2,399,304
11,498,848
2012-07-16T06:03:00.000
0
0
1
0
python,celery
11,498,943
2
false
0
0
You could using sys.setcheckinterval(somebignumber) setcheckinterval(...) setcheckinterval(n) Tell the Python interpreter to check for asynchronous events every n instructions. This also affects how often thread switches occur.
1
4
0
I'm making a "python debug mapper" that shows a 'snapshot' of current python execution Currently, I need to know a way to pause every other threads so that the 'capture' won't happen while other threads are running. Are there any way to do: PauseOtherThreads(); ResumeOtherThreads(); Thanks. p.s: should I make any mod...
How can I pause all the other threads in Python?
0
0
0
404
11,500,239
2012-07-16T08:00:00.000
0
0
0
0
python,sqlalchemy
11,500,397
3
false
0
0
You can run the SHOW TABLE TABLENAME and get the columns of the tables.
1
4
0
Is it possible to determine fields available in a table (MySQL DB) pragmatically at runtime using SQLAlchemy or any other python library ? Any help on this would be great. Thanks.
How to determine fields in a table using SQLAlchemy?
0
1
0
103
11,501,950
2012-07-16T09:52:00.000
0
0
0
0
python,django,apache,nginx,webserver
11,502,051
4
false
1
0
Nginx is probably the best http server, there is no need to replace it. I will advise you to upload very large files via ftp or nfs share.
1
5
0
I use django to run my website and nginx for front webserver , but when i upload a very large file to my site, it take me very long time , there is some thing wrong when nginx hand upload large file; the nginx will send the file to django after receive all my post file; so this will take me more time; i want to find s...
Is there any way to upload a very large file use django on nginx?
0
0
0
3,455
11,502,928
2012-07-16T11:01:00.000
0
0
0
0
python,windows
11,557,820
2
true
0
1
ALright, I've come up with an answer. Instead of using webkit, which doesn't seem to have flash support on windows, I'm gonna use the chromium embedded framework. It should let me do what I need to do, which is embed flash in a desktop app, whilst also allowing for the option of a html based interface. It's open source...
1
2
0
I am looking for a way to play video streams with python. I couldn't find anything nice, so I ended up embedding webkit inside a gtk window, and streaming the video in there. it works well, but feels rather hacky to me. So, my question(s): Is there any other way to stream video (youtube, justin tv) using python and gtk...
Embeding flash in WebKit for pygtk on windows
1.2
0
0
551
11,505,231
2012-07-16T13:20:00.000
2
0
0
0
python,json,web-services,web-frameworks
11,505,774
1
true
1
0
I'm no doubt going to be shot down for this answer, but it needs to be said... You're going to write a service that allows tens of transfers a second, with very large file sizes... Uptime is going to be essential and so is transfer speeds etc... If this is for a business, and not just a personal pet project get the per...
1
0
0
I'm gonna write a web service which will allow upload/download of files, managing permissions and users. It will be the interface to which a Desktop app or Mobile App will communicate. I was wondering which of the web frameworks I should use to to that? It is a sort of remote storage for media files. I am going to host...
Python web framework suggestion for a web service
1.2
0
1
170
11,507,039
2012-07-16T15:02:00.000
8
0
1
0
python,vim
11,509,793
5
true
0
0
Rather than use imaps like @CG Mortion's answer suggests, I would strongly advise you to use iabbrs for these sorts of small fixes instead. With an imap you would never be able to type "define" in insert mode unless you paused between pressing 'd', 'e', or 'f', or did one of a number of other hacky things to prevent th...
1
9
0
I recently switched to Vim at the request of a friend after Sublime Text 2 decided it didn't believe a module was installed even though it was...I digress. I've managed to set up some stuff to make editing Python (currently me only language) easier. However, there's one feature I'm missing from Sublime. It would automa...
Automatic insertion of a colon after 'def', 'if' etc
1.2
0
0
723
11,507,279
2012-07-16T15:16:00.000
2
0
0
0
python,scrapy,web-crawler,language-detection
11,507,534
8
false
1
0
If the sites are multilanguage you can send the "Accept-Language:en-US,en;q=0.8" header and expect the response to be in english. If they are not, you can inspect the "response.headers" dictionary and see if you can find any information about the language. If still unlucky, you can try mapping the IP to the country and...
1
5
0
i am writing a Bot that can just check thousands of website either they are in English or not. i am using Scrapy (python 2.7 framework) for crawling each website first page , can some one suggest me which is the best way to check website language , any help would be appreciated.
python website language detection
0.049958
0
1
4,124
11,508,093
2012-07-16T16:01:00.000
3
0
1
1
python,packaging,pip,pypi
11,508,441
1
true
0
0
distribute is a fork of setuptools with better perhaps documentation. You basically have distutils (stdlib) and setuptools as your choices. Since distutils doesn't let you specify dependencies, only setuptools is left. You generally list all dependencies, and document the installation procedure clearly (including in th...
1
6
0
I would like to package a Python scientific application for PyPI. My problem is that it relies on PyPI-level deps (e.g. numpy, scipy, etc.) as well as others which must be dealt at the OS-level: wxPython and Python-VTK (e.g. with apt-get on Ubuntu, homebrew on OSX, etc). I'd like to know what would be the ideal strateg...
Packaging a Python app with PyPI + OS-level dependencies
1.2
0
0
220
11,508,670
2012-07-16T16:38:00.000
1
0
0
0
php,python,mysql,pyqt4,mysql-python
11,510,083
2
false
0
0
I believe you're asking about whether Python or PHP (what I think you mean by browser?) is more efficient at making a database call. The answer? It depends on the specific code and calls, but it's going to be largely the same. Both Python and PHP are interpreted languages and interpret the code at run time. If either o...
2
0
0
I wanted to know whether mysql query with browser is faster or python's MySQLdb is faster. I am using MysqlDb with PyQt4 for desktop ui and PHP for web ui.
browser query vs python MySQLdb query
0.099668
1
0
161
11,508,670
2012-07-16T16:38:00.000
0
0
0
0
php,python,mysql,pyqt4,mysql-python
11,509,874
2
false
0
0
Browsers don't perform database queries (unless you consider the embedded SQLite database), so not only is your question nonsensical, it is in fact completely irrelevant.
2
0
0
I wanted to know whether mysql query with browser is faster or python's MySQLdb is faster. I am using MysqlDb with PyQt4 for desktop ui and PHP for web ui.
browser query vs python MySQLdb query
0
1
0
161
11,509,228
2012-07-16T17:14:00.000
1
0
1
1
python,virtualenv
22,384,632
2
false
0
0
The support for python2.4 was dropped in virtualenv 1.8 therefore make sure you use virtualenv<=1.7.2.
1
4
0
When using virtualenv I find that the command: virtualenv -p python2.6 --no-site-packages ~/env/NEW_PROJECT works without any problems, however if I try to do virtualenv -p python2.4 --no-site-packages ~/env/NEW_PROJECT I receive the error "The executable python2.4 (from --python=python2.4) does not exist. Is there a...
Virtualenv Python 2.4
0.099668
0
0
1,376
11,510,032
2012-07-16T18:10:00.000
0
1
0
1
java,python
11,511,519
5
false
0
0
I second the answer by @Eero Aaltonen -- you should run your stuff under nice. A Linux computer can run at 100% CPU busy, yet feel nice and fast for the user, if the extra tasks are all under nice; the scheduler will only run the nice tasks when the main user's tasks are idle. But if you want to figure out if the mach...
2
2
0
I want to write a program that ssh's into remote boxes and runs jobs there if the remote computer is not actively being used. I'll be logging in as clusterJobRunner@remoteBox, and the other user will be logged in as someLocalUser@remoteBox. Is there a way to see if a remote user is actively using the box using either ...
How can I find out if someone is actively using a Linux computer in Python or Java?
0
0
0
1,087
11,510,032
2012-07-16T18:10:00.000
1
1
0
1
java,python
11,510,091
5
false
0
0
In Java you can execute the users Linux command using Runtime.exec(), grab the standard output and get it into a parsable String. I don't think there are any OS-independent ways to do this.
2
2
0
I want to write a program that ssh's into remote boxes and runs jobs there if the remote computer is not actively being used. I'll be logging in as clusterJobRunner@remoteBox, and the other user will be logged in as someLocalUser@remoteBox. Is there a way to see if a remote user is actively using the box using either ...
How can I find out if someone is actively using a Linux computer in Python or Java?
0.039979
0
0
1,087
11,512,413
2012-07-16T20:55:00.000
0
0
0
1
python,path,directory,tilde,getcwd
11,512,534
4
false
0
0
Try to use os.path.realpath, os.path.normpath.
2
4
0
How can I get python to return the full pathname of C:\myfolderisafolder\test?
Python os.getcwd() returns with tilde in the path. e.g. C:\MYFOLD~1\test
0
0
0
1,149
11,512,413
2012-07-16T20:55:00.000
0
0
0
1
python,path,directory,tilde,getcwd
11,523,138
4
false
0
0
You could just split the string with .split() at the tilde and then rejoin the full filepath with the .join() methods.
2
4
0
How can I get python to return the full pathname of C:\myfolderisafolder\test?
Python os.getcwd() returns with tilde in the path. e.g. C:\MYFOLD~1\test
0
0
0
1,149
11,514,414
2012-07-17T00:13:00.000
3
1
1
0
python,character-encoding,python-3.x,locale
11,516,682
1
true
0
0
In Windows, with Python 3.3+, execute chcp 65001 in the console or a batch file before running Python in order to change the locale encoding to UTF-8.
1
8
0
[Using Python 3.2] If I don't provide encoding argument to open, the file is opened using locale.getpreferredencoding(). So for example, on my Windows machine, any time I use open('abc.txt'), it would be decoded using cp1252. I would like to switch all my input files to utf-8. Obviously, I can add encoding = 'utf-8' to...
Changing the "locale preferred encoding"
1.2
0
0
3,877
11,514,608
2012-07-17T00:44:00.000
2
1
0
1
python,http,command-line,cgi
11,515,334
2
false
0
0
Are the teammates developers or comfortable with the command line? If so, I would propose SSH. Run SSHD on the box with the scripts. On Windows, this is easy with cygwin, otherwise it's there by default on Mac and Linux The client logs in (ssh user@host) and runs the script. Set up security with certificates and you wo...
1
0
0
We've got a number of perl and python scripts we want to expose to some of our teammates for casual usage; and we really don't want ot deal with getting them setup with git, perl, python, dependencies, etc. One idea we had was to write a descriptor for each script as to what arguments it needed; and then let a simple H...
Exposing commandline tools remotely to users
0.197375
0
0
132
11,515,944
2012-07-17T04:17:00.000
9
0
1
0
python,multithreading,multiprocessing
48,592,969
7
false
0
0
in "from queue import Queue" there is no module called queue, instead multiprocessing should be used. Therefore, it should look like "from multiprocessing import Queue"
1
136
0
I'm having much trouble trying to understand just how the multiprocessing queue works on python and how to implement it. Lets say I have two python modules that access data from a shared file, let's call these two modules a writer and a reader. My plan is to have both the reader and writer put requests into two separat...
How to use multiprocessing queue in Python?
1
0
0
221,619
11,517,143
2012-07-17T06:33:00.000
0
0
1
0
python,performance
11,517,362
1
true
0
0
What you ask is quite of a problem. Different data structures have different properties. In general, if you need quick access, do not use lists! They have linear access time, which means, the more you put in them, the longer it will take in average to access an element. You could perhaps use numpy? That library has ma...
1
1
1
I will need to create array of integer arrays like [[0,1,2],[4,4,5,7]...[4,5]]. The size of internal arrays changeable. Max number of internal arrays is 2^26. So what do you recommend for the fastest way for updating this array. When I use list=[[]] * 2^26 initialization is very fast but update is very slow. Instead I...
Fast access and update integer matrix or array in Python
1.2
0
0
497
11,517,743
2012-07-17T07:21:00.000
1
0
0
1
python,process,applescript
11,518,020
2
false
0
0
I realized GUI applescript was the answer in this scenario. With it I could tell the PROCESS to get every window, and that worked. However, I'm leaving this up because I'd like to know other ways. I'm sure this GUI workaround won't work for everything.
1
0
0
I'd like to know how to have a program wait for another program to finish a task. I'm not sure what I'd look for for that... Also, I'm using a mac. I'd like to use Python or perhaps even applescript (I could just osascript python if the solution if for applescript anyway) Basically this program "MPEGstreamclip" convert...
Waiting for a program to finish its task
0.099668
0
0
220
11,520,573
2012-07-17T10:25:00.000
1
0
0
1
google-app-engine,python-2.7
11,533,684
3
false
1
0
it's been a while, but I believe I've previously fixed this by adding import rdbms to dev_appserver.py hmm.. or was that import MySQLdb? (more likely)
2
3
0
Trying to do HelloWorld on GoogleAppEngine, but getting the following error. C:\LearningGoogleAppEngine\HelloWorld>dev_appserver.py helloworld WARNING 2012-07-17 10:21:37,250 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded. Traceback (most recent call last): File "C:...
GoogleAppEngine error: rdbms_mysqldb.py:74
0.066568
1
0
1,146
11,520,573
2012-07-17T10:25:00.000
0
0
0
1
google-app-engine,python-2.7
12,513,978
3
false
1
0
just had the exact same error messages: I found that restarting Windows fixed everything and I did not have to deviate from the YAML or py file given on the google helloworld python tutorial.
2
3
0
Trying to do HelloWorld on GoogleAppEngine, but getting the following error. C:\LearningGoogleAppEngine\HelloWorld>dev_appserver.py helloworld WARNING 2012-07-17 10:21:37,250 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded. Traceback (most recent call last): File "C:...
GoogleAppEngine error: rdbms_mysqldb.py:74
0
1
0
1,146
11,520,713
2012-07-17T10:34:00.000
1
1
1
1
python,linux,ascii,vi
11,520,748
2
true
0
0
The $ is displayed by vi (in certain modes). It is not in the file contents. You could use od -cx yourfile to check that.
1
0
0
I am reading a ASCII file from LINUX(Debian) into Python CGI script where it is edited via a web page and then saved, If I use a graphical text editor the edited and un-edited file appear the same and are corectly formatted. Using vi the edited file contains ctrl M as the EOL marker and all lines rolled into one but ...
LINUX End of Line
1.2
0
0
409
11,522,232
2012-07-17T12:15:00.000
0
0
0
0
python,nosql
11,522,576
3
false
0
0
If this is just a one-time process, you might want to just setup an EC2 node with more than 1G of memory and run the python scripts there. 5 million items isn't that much, and a Python dictionary should be fairly capable of handling it. I don't think you need Hadoop in this case. You could also try to optimize your scr...
1
1
1
I would like to get the suggestion on using No-SQL datastore for my particular requirements. Let me explain: I have to process the five csv files. Each csv contains 5 million rows and also The common id field is presented in each csv.So, I need to merge all csv by iterating 5 million rows.So, I go with python ...
Process 5 million key-value data in python.Will NoSql solve?
0
1
0
347
11,524,756
2012-07-17T14:30:00.000
0
0
0
0
python,django,view
56,405,887
4
false
1
0
add to setting.py part of TEMPLATE append to context_processors list -> app_name.view.base,
1
0
0
I have notification scrollbar like on fb or twitter. Top menu.html is directly included by base.html Unfortunatelly, I can use only User method there. Is it possible to not write in every view that I need notifications? I want to once paste in one view and have it always in top menu.html which is in base! from intarfac...
view in base.html django
0
0
0
1,353
11,525,717
2012-07-17T15:23:00.000
0
0
1
1
python,google-app-engine
11,857,757
3
false
1
0
If I set threadsafe: true in my app.yaml file, what are the rules that govern when a new instance will be created to serve a request, versus when a new thread will be created on an existing instance? Like people are saying here, if a previous instance is already using 10 threads, a new instance with a new thread would...
1
60
0
If I set threadsafe: true in my app.yaml file, what are the rules that govern when a new instance will be created to serve a request, versus when a new thread will be created on an existing instance? If I have an app which performs something computationally intensive on each request, does multi-threading buy me anythin...
When does the App Engine scheduler use a new thread vs. a new instance?
0
0
0
2,794
11,526,228
2012-07-17T15:49:00.000
3
0
1
1
python,environment-variables
11,526,266
1
true
0
0
Err, the simple answer while trying to make this at least 30chars is - Yes. (It doesn't matter what it's set to, as long as it's set - although 1 would probably be reasonable). If you don't want to do it on a system level/user level basis, then you can always run python with the -B option.
1
1
0
I would like to prevent python from automatically creating __pycache__ directories. From some searching, I have learned that I need to set the PYTHONDONTWRITEBYTECODE python environment variable. In a Windows environment, is this set the exact same way I would set any other system environmental variable (such as PATH)...
How to set python environmental variables?
1.2
0
0
559
11,526,975
2012-07-17T16:36:00.000
4
0
1
0
python,random,seed
11,539,965
9
false
0
0
Jon Clements pretty much answers my question. However it wasn't the real problem: It turns out, that the reason for my code's randomness was the numpy.linalg SVD because it does not always produce the same results for badly conditioned matrices !! So be sure to check for that in your code, if you have the same problems...
7
101
0
I have a rather big program, where I use functions from the random module in different files. I would like to be able to set the random seed once, at one place, to make the program always return the same results. Can that even be achieved in python?
set random seed programwide in python
0.088656
0
0
99,367
11,526,975
2012-07-17T16:36:00.000
3
0
1
0
python,random,seed
61,290,441
9
false
0
0
Building on previous answers: be aware that many constructs can diverge execution paths, even when all seeds are controlled. I was thinking "well I set my seeds so they're always the same, and I have no changing/external dependencies, therefore the execution path of my code should always be the same", but that's wrong....
7
101
0
I have a rather big program, where I use functions from the random module in different files. I would like to be able to set the random seed once, at one place, to make the program always return the same results. Can that even be achieved in python?
set random seed programwide in python
0.066568
0
0
99,367
11,526,975
2012-07-17T16:36:00.000
1
0
1
0
python,random,seed
65,071,570
9
false
0
0
One important caveat is that for python versions earlier than 3.7, Dictionary keys are not deterministic. This can lead to randomness in the program or even a different order in which the random numbers are generated and therefore non-deterministic random numbers. Conclusion update python.
7
101
0
I have a rather big program, where I use functions from the random module in different files. I would like to be able to set the random seed once, at one place, to make the program always return the same results. Can that even be achieved in python?
set random seed programwide in python
0.022219
0
0
99,367
11,526,975
2012-07-17T16:36:00.000
0
0
1
0
python,random,seed
68,950,180
9
false
0
0
I was also puzzled by the question when reproducing a deep learning project.So I do a toy experiment and share the results with you. I create two files in a project, which are named test1.py and test2.py respectively. In test1, I set random.seed(10) for the random module and print 10 random numbers for several times. A...
7
101
0
I have a rather big program, where I use functions from the random module in different files. I would like to be able to set the random seed once, at one place, to make the program always return the same results. Can that even be achieved in python?
set random seed programwide in python
0
0
0
99,367
11,526,975
2012-07-17T16:36:00.000
-16
0
1
0
python,random,seed
11,527,594
9
false
0
0
You can guarantee this pretty easily by using your own random number generator. Just pick three largish primes (assuming this isn't a cryptography application), and plug them into a, b and c: a = ((a * b) % c) This gives a feedback system that produces pretty random data. Note that not all primes work equally well, bu...
7
101
0
I have a rather big program, where I use functions from the random module in different files. I would like to be able to set the random seed once, at one place, to make the program always return the same results. Can that even be achieved in python?
set random seed programwide in python
-1
0
0
99,367
11,526,975
2012-07-17T16:36:00.000
9
0
1
0
python,random,seed
11,527,103
9
false
0
0
In the beginning of your application call random.seed(x) making sure x is always the same. This will ensure the sequence of pseudo random numbers will be the same during each run of the application.
7
101
0
I have a rather big program, where I use functions from the random module in different files. I would like to be able to set the random seed once, at one place, to make the program always return the same results. Can that even be achieved in python?
set random seed programwide in python
1
0
0
99,367
11,526,975
2012-07-17T16:36:00.000
140
0
1
0
python,random,seed
11,527,011
9
true
0
0
The main python module that is run should import random and call random.seed(n) - this is shared between all other imports of random as long as somewhere else doesn't reset the seed.
7
101
0
I have a rather big program, where I use functions from the random module in different files. I would like to be able to set the random seed once, at one place, to make the program always return the same results. Can that even be achieved in python?
set random seed programwide in python
1.2
0
0
99,367
11,527,032
2012-07-17T16:39:00.000
2
0
0
1
python,macports
11,604,656
1
true
0
0
-set is still there. The issue you have that you are missing a couple of arguments to the command. It should be sudo port select --set python python27 The port command takes an action and the one here is select. port select --set then takes as first argument the group it is select for in this case python.
1
0
0
I am trying to change my default python to python27, I executed sudo port --set python27 but ended up with following error on my Mac Lion 10.7 Error: global does not accept --set. I was trying to see if MacPorts have deprecated the --set command and has introduced a new command instead. But I was unable to find anythin...
MacPort: global does not accept --set
1.2
0
0
62
11,527,100
2012-07-17T16:44:00.000
1
0
0
0
python,excel,formula,xlrd,xlwt
11,596,820
1
false
0
0
(a) xlrd does not currently support extracting formulas. (b) You say "XLWT Formula does not support advanced i.e. VLOOKUP Formulas". This is incorrect. If you are the same person that I seem to have convinced that xlwt supports VLOOKUP etc after a lengthy exchange of private emails over the last few days, please say s...
1
1
0
I am working on the XLWT XLRD XLUTIL packages. Whenever I write to a new sheet, all the formulas have been obliterated. I tried the following fixes, but they all failed: Re-write all the formulas in with a loop: Failure: XLWT Formula does not support advanced i.e. VLOOKUP Formulas Doing the calculations all in Python...
Preserving Formula in Excel Python XLWT
0.197375
1
0
1,819
11,528,009
2012-07-17T17:48:00.000
0
0
0
0
python,opencv
51,053,926
2
false
0
0
2-way to apply: img = cv2.imread(img_path) img_buf = cv2.imencode('.jpg', img)[1].tostring() just read the image file: img_buf = open(img_path, 'rb').read()
1
8
1
I have an image that I load using cv2.imread(). This returns an NumPy array. However, I need to pass this into a 3rd party API that requires the data in IplImage format. I've scoured everything I could and I've found instances of converting from IplImage to CvMat,and I've found some references to converting in C++, b...
OpenCV: Converting from NumPy to IplImage in Python
0
0
0
10,288
11,528,327
2012-07-17T18:07:00.000
1
0
1
1
python,virtualenv
11,528,399
3
false
0
0
You could try pip install -U python from within the virtual environment, not sure what it would break. You could also change the symlinks that point to the old Python, but not sure what side effects that would have. I would recommend the safest path, that is to first pip freeze > installed.txt and then recreate your vi...
1
2
0
I had installed virtualenv on the system with python2.6. I upgraded the system python to 2.7, but the virtualenv still has affinity for python2.6. I tried easy_install --upgrade virtualenv, but that didn't change anything. Does anyone know how to update the system installed virtualenv to use the new python2.7 on the sy...
How to upgrade virtualenv to use a new system python?
0.066568
0
0
2,650
11,529,450
2012-07-17T19:25:00.000
0
0
0
0
python,selenium,webdriver,frame,basic-authentication
11,547,170
1
false
1
0
Solution: go to the url of the frame itself, and set page load timeout on that page
1
0
0
I'm using selenium in python to check the page of a website that uses basic authentication on one frame. I'm checking to see if the password I am entering is correct or not, so the basic authentication often gets stuck because the password is wrong. Normally I use sel.set_page_load_timeout(8) and then catch the excepti...
Selenium stuck loading frame with basic authentication
0
0
1
230
11,530,196
2012-07-17T20:16:00.000
2
0
0
0
python,sqlalchemy,flask-sqlalchemy
68,064,416
10
false
1
0
result = ModalName.query.add_columns(ModelName.colname, ModelName.colname)
1
183
0
How do I specify the column that I want in my query using a model (it selects all columns by default)? I know how to do this with the sqlalchmey session: session.query(self.col1), but how do I do it with with models? I can't do SomeModel.query(). Is there a way?
Flask SQLAlchemy query, specify column names
0.039979
1
0
191,024
11,531,025
2012-07-17T21:18:00.000
1
0
0
1
django,python-2.7,osx-server
11,531,064
2
false
1
0
Install it against the updated Python.
1
0
0
I am using Django on my Mac OS X server. Things are fine, so far. I have been using python 2.6.1 and all works well. I upgraded Python to version 2.7.3. Invoking python in the terminal brings up version 2.7.3, as expected. Checking Django using the {% debug %) reveals that Django is still using the original python 2.6....
How to get Django to use an updated python on Mac OS X server?
0.099668
0
0
251
11,533,169
2012-07-18T01:41:00.000
0
0
1
0
python,windows,memory,timer,windows-vista
11,533,237
3
false
0
0
If it is going to have a GUI, you could build this application easily using Tkinter using the after method of tkinter widgets. If you're not going to have a GUI, you'll probably need 2 threads (1 to do the timing, 1 to accept input from the keyboard).
1
0
0
I'm working on a Python program that is to use a timer. It is going to be a memory game where a word pops up and a timer counts to 5 and after 5 seconds the words disappears and you have to type the word from memory. I have already searched around a little and have seen things that time the execution time of a progra...
Trying to find a timer in Python
0
0
0
241
11,533,524
2012-07-18T02:33:00.000
8
0
1
0
python,python-3.x,python-2.7,ubuntu-12.04,python-2to3
11,533,625
1
true
0
0
They are both 2to3, but one is part of your Python 2.7 installation, and the other is part of your Python 3.1 installation. If you look at the bin directory in a Python X.Y installation, each foo executable will also be named foo-X.Y, so that you can run a specific version by name.
1
3
0
My Ubuntu 12.04 stock python install has 2 programs for converting code to Python 3.x: 2to3-2.7 and 2to3-3.1. What's the difference?
What's the difference between 2to3-2.7 and 2to3-3.1?
1.2
0
0
1,387
11,534,826
2012-07-18T05:32:00.000
2
1
0
0
php,python,network-programming
11,535,406
2
true
0
1
General Response Especially if you include a "waiting room" and such things/ want this to be widely usable, this is a rather big project (definitely not a bad thing, but you may want to do some small projects first to get your feet wet with python programming for the web). However, it is relatively easy to have a simpl...
1
0
0
So I made a game in PHP that worked fairly well, a simple game fairly similar to tic-tac-toe, I didn't really want to go much further with PHP improving the game. With that in mind I decided to learn Python; I'm familiar with the basics now. I used simple math, dictionaries and conditional statements to create a mock...
Wanting to make a turn-based python game. Where do I go from here?
1.2
0
0
1,912
11,537,981
2012-07-18T09:12:00.000
0
0
1
1
python,eclipse,pydev
11,579,758
2
false
0
0
My guess is that the problem is that you're probably pointing to a shortcut and not the actual executable, so, can you check if you're really giving the executable (and not a shortcut) in the interpreter configuration process? If that's not the case, please post details you may have in your error log during that proces...
1
0
0
Possible duplicate but i couldn't find one. I've downloaded python and am having trouble loading it into eclipse, has anyone got a fool proof ground up solution that is garaunteed to work. This is what i've tried, Window--preferences--new--specified(Python 32) and C:\ directory file to python.exe but it keeps spitting...
Eclpise and pyDev
0
0
0
86