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
30,519,299
2015-05-29T00:34:00.000
0
0
0
0
python,postgresql,amazon-rds,gevent
30,519,353
2
false
1
0
You could try this from within psql to get more details on query timing EXPLAIN sql_statement Also turn on more database logging. mysql has slow query analysis, maybe PostgreSQL has an equivalent.
1
0
0
First, the server setup: nginx frontend to the world gunicorn running a Flask app with gevent workers Postgres database, connection pooled in the app, running from Amazon RDS, connected with psycopg2 patched to work with gevent The problem I'm encountering is inexplicably slow queries that are sometimes running on th...
Inconsistently slow queries in production (RDS)
0
1
0
1,181
30,519,737
2015-05-29T01:34:00.000
3
0
1
0
python,python-3.x
30,519,763
3
false
0
0
You can't change the values in tuples, tuples are immutable. You would need to make them be lists or create a new tuple with the value you you want and store that.
1
11
0
Suppose that I have tuples of the form [(('d',0),('g',0)),(('d',0),('d',1)),(('i',0),('g',0))] Then how do I increment the numbers inside the tuple that they are of the form:- [(('d',1),('g',1)),(('d',1),('d',2)),(('i',1),('g',1))] ? I am able to do this in a single for loop. But I am looking for shorter methods. P....
how to increment inside tuple in python?
0.197375
0
0
13,989
30,524,215
2015-05-29T07:58:00.000
0
0
1
0
windows,python-2.7,append,sys.path
30,524,216
1
true
0
0
I figured out how whilst typing my question. Just use a double back slash before directories starting with numbers: I.e. sys.path.append("C:\Postgrad\\2015\Records\\20150528\RAMP_UP2") Returns: 'C:\Postgrad\2015\Records\20150528\RAMP_UP2'
1
0
0
I am having trouble using the sys.path.append() function. When I try to append a path which contains directories names starting with numbers the directories are not correctly named. For example: sys.path.append("C:Postgrad\2015\Records\20150528\RAMP_UP2") Returns: 'C:\Postgrad\x815\Records\x8150528\RAMP_UP2' In the sys...
Error Using sys.path.append - Function copies path incorrectly
1.2
0
0
124
30,526,510
2015-05-29T09:52:00.000
2
0
0
0
python,django,python-2.7,django-models
62,368,839
1
false
1
0
To track history for a model and fix ur issues to use of this code. pip install django-simple-history
1
2
0
I am using django-simple-history for maintaining the history for each model. Now when I import the model in my management command it gives import error "cannot find import name 'ModelName'". Any Help regarding this.?
django-simple-history cannot import name error for model import in management command
0.379949
0
0
1,268
30,528,852
2015-05-29T11:49:00.000
2
0
0
0
python,numpy,nan
30,529,135
3
false
0
0
From what I understand NaN represents anything that is not a number, while a masked array marks missing values OR values that are numbers but are not valid for your data set. I hope that helps.
2
13
1
In numpy there are two ways to mark missing values: I can either use a NaN or a masked array. I understand that using NaNs is (potentially) faster while masked array offers more functionality (which?). I guess my question is if/ when should I use one over the other? What is the use case of np.NaN in a regular array vs....
numpy: difference between NaN and masked array
0.132549
0
0
2,235
30,528,852
2015-05-29T11:49:00.000
1
0
0
0
python,numpy,nan
52,755,040
3
false
0
0
Keep in mind that strange np.nan behaviours, mentioned by jrmyp, include unexpected results for example when using functions of the statsmodels (e.g. ttest) or numpy module (e.g. average). From experience, most those functions have workarounds for NaNs, but it has the potential of driving you mad for a while. This seem...
2
13
1
In numpy there are two ways to mark missing values: I can either use a NaN or a masked array. I understand that using NaNs is (potentially) faster while masked array offers more functionality (which?). I guess my question is if/ when should I use one over the other? What is the use case of np.NaN in a regular array vs....
numpy: difference between NaN and masked array
0.066568
0
0
2,235
30,533,189
2015-05-29T15:15:00.000
1
0
1
0
python,string,null,escaping,backslash
30,533,575
1
false
0
0
Considering all comments it looks like incorrectly used PIL/Pillow API, namely the Image.open function that requires file name instead of file data.
1
1
0
I'm using Python 2.6 and I have a variable which contains a string (I have sent it thorugh sockets and now I want to do something with it). The problem is that I get the following error: TypeError: file() argument 1 must be encoded string without NULL bytes, not str After I looked it up I found out that the problem i...
Ignoring escape sequences
0.197375
0
0
666
30,533,263
2015-05-29T15:18:00.000
3
0
1
1
python,vim,nerdtree,python-mode,netrw
30,533,662
3
true
0
0
But having a file opened, if I open netrw by typing :E and open another file by hitting <enter> VIM closes the old one and opens the new one in the same window. [...] How can I open multiple files/buffers in the same window using netrw? Buffers are added to a list, the buffer list, and facultatively displayed in one ...
1
2
0
I have recently switched to VIM using NERDTree and python-mode. As NERDTree seems to have a conflict with python-mode and breaks my layout if I close one out of multiple buffers, I decided to switch to netrw since it is shipped with VIM anyway. But having a file opened, if I open netrw by typing :E and open another fil...
VIM + netrw: open multiple files/buffers in the same window
1.2
0
0
3,905
30,535,810
2015-05-29T17:38:00.000
0
0
0
0
python,visual-studio,python-3.x,matplotlib,ptvs
30,576,274
2
true
0
0
All of the attempts sounds futile... Even removing the VS is a challenging stuff... and as people consider, changing the OS is the most stable way to get rid of VS in the presence of such anomalies regarding its libraries... So... I changed the OS... and installed the VS and PTVS again...
2
1
1
Here is a Python 3.4 user, in VS 2013 and PTVS... I'd written a program to plot something by Matplotlib... The output had been generating and everything was ok... So, I closed VS and now I've opened it again after an hour, running the very script, but this time as soon as I press F5, a window appears and says Python ha...
Python access violation
1.2
0
0
659
30,535,810
2015-05-29T17:38:00.000
-1
0
0
0
python,visual-studio,python-3.x,matplotlib,ptvs
30,536,536
2
false
0
0
It seems to be a problem with your python and PTVS. Try to remove every .pyc file and have another go at it
2
1
1
Here is a Python 3.4 user, in VS 2013 and PTVS... I'd written a program to plot something by Matplotlib... The output had been generating and everything was ok... So, I closed VS and now I've opened it again after an hour, running the very script, but this time as soon as I press F5, a window appears and says Python ha...
Python access violation
-0.099668
0
0
659
30,535,831
2015-05-29T17:39:00.000
0
1
0
0
python,libraries,coordinate-systems,satellite,sgp4
57,221,666
1
false
0
0
Michael mentioned it in his comment, but PyEphem I believe is deprecated as of the current Python 3 version. That being said, if you are to use TLEs, SGP4 was made to handle TLEs in particular. The non-keplerian and non-newtonian terms you see in TLEs are specifically passed into the SGP4 propagator (B* drag, second de...
1
5
0
The landscape of Python tools that seem to accomplish the task of propagating Earth satellites/celestial bodies is confusing. Depending on what you're trying to do, PyEphem or Python-SGP4 may be more suitable. Which of these should I use if: I want ECEF/ECI coordinates of an Earth satellite I want general sky coordina...
Which should I use: Python-sgp4, PyEphem, python-skyfield
0
0
0
2,484
30,536,946
2015-05-29T18:48:00.000
1
0
1
0
pip,python-3.4
48,930,745
6
false
0
0
If you hace problems with the python command only need add the route C:/python34 or the route went you have python installed: List item Right click on "My computer" Click "Properties" Click "Advanced system settings" in the side panel Click "Environment Variables" Click the "New" below system variables find the path v...
4
20
0
What command should I use in command prompt to install requests module in python 3.4 version ??? pip install requests is not useful to install requests module in python 3.4 version. Because while running the script below error is coming ImportError : no module named 'requests'
How to install requests module in python 3.4 version on windows?
0.033321
0
1
108,064
30,536,946
2015-05-29T18:48:00.000
58
0
1
0
pip,python-3.4
30,537,052
6
true
0
0
python -m pip install requests or py -m pip install requests
4
20
0
What command should I use in command prompt to install requests module in python 3.4 version ??? pip install requests is not useful to install requests module in python 3.4 version. Because while running the script below error is coming ImportError : no module named 'requests'
How to install requests module in python 3.4 version on windows?
1.2
0
1
108,064
30,536,946
2015-05-29T18:48:00.000
3
0
1
0
pip,python-3.4
42,662,073
6
false
0
0
On Windows, I found navigating to my Python folder via CMD worked cd C:\Python36\ and then running the commandline: python -m pip install requests
4
20
0
What command should I use in command prompt to install requests module in python 3.4 version ??? pip install requests is not useful to install requests module in python 3.4 version. Because while running the script below error is coming ImportError : no module named 'requests'
How to install requests module in python 3.4 version on windows?
0.099668
0
1
108,064
30,536,946
2015-05-29T18:48:00.000
0
0
1
0
pip,python-3.4
64,150,710
6
false
0
0
After installing python which comes with pip run and exe and input "pip install requests" It should do
4
20
0
What command should I use in command prompt to install requests module in python 3.4 version ??? pip install requests is not useful to install requests module in python 3.4 version. Because while running the script below error is coming ImportError : no module named 'requests'
How to install requests module in python 3.4 version on windows?
0
0
1
108,064
30,538,062
2015-05-29T19:56:00.000
0
0
0
0
python,function,matplotlib,dataset
30,674,814
1
false
0
0
At the end the solution has been easier than I thought. I had simply to define the continuous variable through the discrete data, as, for example: w=x/y, then define the function as already said: exfunct=w**4 and finally plot the "continuous-discrete" function: plt.plot(x,x/exfunct),'k-',color='red',lw=2) I hope this c...
1
0
1
I need to plot a ratio between a function introduced thorough a discrete data set, imported from a text file, for example: x,y,z=np.loadtxt('example.txt',usecols=(0,1,2),unpack=True), and a continuous function defined using the np.arange command, for example: w=np.arange(0,0.5,0.01) exfunct=w**4. Clearly, solutions as ...
matplotlib discrete data versus continuous function
0
0
0
1,808
30,538,356
2015-05-29T20:17:00.000
1
1
0
0
python,robotframework
30,659,802
2
false
0
0
I took a relatively quick look through the sources, and it seems that the execution context does have any reference to currently executing keyword. So, the only way I can think of resolving this is: Your library needs also to be a listener, since listeners get events when a keyword is started You need to go through ro...
1
1
0
I want to create a python library with a 0 argument function that my custom Robot Framework keywords can call. It needs to know the absolute path of the file where the keyword is defined, and the name of the keyword. I know how to do something similar with test cases using the robot.libraries.BuiltIn library and the ...
Robot Framework location and name of keyword
0.099668
0
0
2,627
30,538,673
2015-05-29T20:40:00.000
2
0
1
0
python,list,python-2.7,list-comprehension
30,538,735
2
false
0
0
You can use the builtin any function for that [item for item in some_list if any(s in item for s in string)]
1
2
0
I have a situation where I am using list comprehension to scan one list and return items that match a certain criteria. [item for item in some_list_of_objects if 'thisstring' in item.id] I want to expand this and have a list of things that can be in the item, the list being of unknown length. Something like this: strin...
Python: List Comprehension with a Nested Loop
0.197375
0
0
144
30,540,776
2015-05-30T00:00:00.000
1
0
1
0
python,python-3.x,currency
30,541,140
2
false
0
0
Look into the regular expressions module. You can compile a pattern that matches your dollars/cents format and extract the floating-point number from it.
1
2
0
I've looked through the 'currency' threads, but they're all for going the other way. I'm reading financial data that comes in as $1,234.56 &c, with everything a string. I split the input line, and want to convert the value item to float for add/subtract (I'm mot worried about roundoff error). Naturally, the float() ...
How to read '$1,234.56' as 1234.56
0.099668
0
0
292
30,540,872
2015-05-30T00:16:00.000
1
0
0
0
python,image,pillow
30,541,163
3
false
0
1
I haven't used Pillow, and I haven't seen your images or code, but let's say you have an image with a resolution of 400x200 and you want to resize it to 200x100, then each of the new pixels needs to have some color. Since the new image is smaller, the colors from the original will have to be mashed together to form the...
1
0
0
I'm experiencing something strange when using Image.resize(). I have two images, one is a cropped version of the other. I've been working out the aspect ratio so that I can resize both images by the same factor and then resizing them separately. Now for some reason, the larger of the two images is resized fine but the ...
Using Python to resize images using Pillow, why are the colours changing?
0.066568
0
0
1,342
30,543,041
2015-05-30T06:23:00.000
1
0
1
1
python,macos
30,543,046
1
true
0
0
python is installed on OSX by default and you just need to open terminal and write ‘python’ command, then you can start your python coding
1
1
0
I'm new to computer programming! I want to learn python and write my program and run it on my mac OS X machine. How can i setup python programming tools on OS X and how can i use that ? I before this never use any other programming language.
How can i install python on OSX?
1.2
0
0
36
30,545,494
2015-05-30T11:18:00.000
0
0
0
0
python,wxpython
30,546,887
1
false
0
1
I found out that wx has a EVT_LIST_ITEM_ACTIVATED event that is triggered when a list item is double clicked. I used this to capture the selected item and display the data accordingly.
1
0
0
I have been working on my first wxpython app and this app has a search functionality. The app has to search for elements from database, list them and display details of one single element, when the element is clicked from the list. I found there is ListView or ObjectListView to be used for this. But what should be used...
Display single element page on click of list element wxpython
0
0
0
33
30,547,102
2015-05-30T14:02:00.000
2
0
0
0
python,django,python-2.7,numpy
30,549,380
1
true
1
0
I assume your question is about "how do I do these calculations in the restful framework for django?", but I think in this case you need to move away from that idea. You did everything correctly but RESTful APIs serve resources -- basically your model. A computation however is nothing like that. As I see it, you have t...
1
1
0
I have developed a RESTful API using the Django-rest-framework in python. I developed the required models, serialised them, set up token authentication and all the other due diligence that goes along with it. I also built a front-end using Angular, hosted on a different domain. I setup CORS modifications so I can acces...
Running complex calculations (using python/pandas) in a Django server
1.2
0
0
2,516
30,553,766
2015-05-31T04:12:00.000
11
0
1
0
python
30,553,899
5
true
0
0
Types aren't used the same way in Python as statically types languages. A hashable object is simply one with a valid hash method. The interpreter simply calls that method, no type checking or anything. From there on out, standard hash map principles apply: for an object to fulfill the contract, it must implement both h...
1
8
0
I understand that the following is valid in Python: foo = {'a': 0, 1: 2, some_obj: 'c'} However, I wonder how the internal works. Does it treat everything (object, string, number, etc.) as object? Does it type check to determine how to compute the hash code given a key?
Python: how does a dict with mixed key type work?
1.2
0
0
16,230
30,554,687
2015-05-31T06:52:00.000
0
0
1
0
python,nlp,nltk
46,657,638
2
false
0
0
The first step is to try and do this job yourself by hand with a pencil. Try it on not just one but a collection of news stories. You really do have to do this and not just think about it. Draw the graphics just as you'd want the computer to. What this does is forces you to create rules about how information is tran...
1
0
0
Objective: I am trying to do a project on Natural Language Processing (NLP), where I want to extract information and represent it in graphical form. Description: I am considering news article as input to my project. Removing unwanted data in the input & making it in Clean Format. Performing NLP & Extracting Informatio...
How to extract Information?
0
0
0
301
30,554,696
2015-05-31T06:53:00.000
2
0
0
0
python,python-2.7,turtle-graphics
30,554,792
2
true
0
1
By default, turtle has a draw delay of 10 milliseconds. Every time it updates the canvas, it will pause 10 milliseconds as a simple way of controlling the animation speed. This delay is independent of the speed of the turtle itself. If you want to speed up the animation, you can set a shorter delay, e.g. with turtle.de...
2
3
0
I got program that draws spaceship (Turtle Graphics) forward,backward etc. By using a lot of orders and lines drawing spaceship takes 5 seconds using turtle.speed(0). And whenever you click the right/left key it draws it again in other direction. It major thing in my project. Is there a way to draw it faster? Than...
Faster drawing in python
1.2
0
0
1,123
30,554,696
2015-05-31T06:53:00.000
1
0
0
0
python,python-2.7,turtle-graphics
30,555,631
2
false
0
1
you can use screen.tracer(n) where a bigger n value means a faster drawing speed but less details
2
3
0
I got program that draws spaceship (Turtle Graphics) forward,backward etc. By using a lot of orders and lines drawing spaceship takes 5 seconds using turtle.speed(0). And whenever you click the right/left key it draws it again in other direction. It major thing in my project. Is there a way to draw it faster? Than...
Faster drawing in python
0.099668
0
0
1,123
30,555,149
2015-05-31T07:59:00.000
0
1
0
0
python,database,algorithm
30,555,758
2
false
0
0
Try to do hack on client side in recording email attempt to a log file. Then you can read that file to count frequency of emails sent. I think that you can put data in memory in dict for some time say for ex 5 or 10 min. Then you can send data to DB thus not putting load on DB of frequent writes. If you put a check in ...
1
1
0
Sorry if the title is misleading. I am trying to write a program that calculates frequency of emails being sent out of different email ids. We need to trigger alerts based on number and frequency of mails sent. For example for a particular email if in past 60 minutes more than 25 mails were sent, a trigger needs to be ...
Strategies for storing frequency of dynamic data
0
0
0
50
30,555,943
2015-05-31T09:38:00.000
6
0
1
0
python,conda,tox
30,555,944
5
true
0
0
While tox can't make use of conda, you can use conda to "install" different Python versions where tox can find them (like it would find "normal" Python installations in those folders). The following is tested on Windows: You need virtualenv installed via pip in the root conda environment. I suspect this is the virtual...
1
29
0
The Python testing tool tox seems to be designed to work with virtualenv. Can it also work on conda/anaconda-based Python installations?
Is it possible to use tox with conda-based Python installations?
1.2
0
0
7,948
30,560,147
2015-05-31T17:05:00.000
0
0
0
0
python,widget,pyqt,pyqt4
30,563,200
1
false
0
1
Use a Qt layout (like a QVBoxLayout, QHBoxLayout, or a QGridLayout)
1
0
0
I'm working on developing a PyQt4 application that will require a lot of widgets and I have run into an issue. When you say where to move the widget to (such as: btn.move(100, 100) it moves it properly, but if you resize the window, you can't see it). I'm not sure how to fix this. I don't want to restrict resizing of t...
How to update PyQt4 widget locations based on window size?
0
0
0
42
30,561,194
2015-05-31T18:38:00.000
0
0
1
0
python
30,561,999
4
false
0
0
Well, del uses just a little less space in the computer as the person above me implied. The computer still accepts the variable as the same code, except with a different value. However, when you variable is assigned something else, the computer assigns a completely different code ID to it in order to account for the ch...
1
34
0
Please what is the most efficient way of emptying a list? I have a list called a = [1,2,3]. To delete the content of the list I usually write a = [ ]. I came across a function in python called del. I want to know if there is a difference between del a [:] and what I use.
what is the difference between del a[:] and a = [] when I want to empty a list called a in python?
0
0
0
5,503
30,561,907
2015-05-31T19:42:00.000
1
0
1
0
python,canopy
31,528,989
1
false
0
0
This is what I did. Install Canopy 1.5.5 Now open Canopy terminal Go to Package Manager-> Updates -> Install all 7 updates Once you install all the updates , you will see both the kernel and 'pip' getting updated. I have not encountered the 'Python kernel has crashed error since then'. Note: I have a Linux OS
1
1
0
When I restart my kernel in Canopy (latest version), it goes into a loop where the kernel will crash repeatedly, and even when restarting repeatedly, it does not exit this loop. It's very annoying to have to do this when something doesn't work, and I'm trying to avoid having to re-install. Any suggestions? P.S.: I have...
Python Canopy kernel keeps crashing
0.197375
0
0
4,429
30,563,177
2015-05-31T22:01:00.000
1
1
1
0
file,python-2.7,encryption,binary
42,172,135
3
false
0
0
Your binary file is coming out looking like text because the file is being treated like it is encoded in an 8 bit encoding (ASCII or Latin-1, etc). Also, in Python 2, bytes and (text) characters are used interchangeably... i.e. a string is just an array of ASCII bytes. You should search the differences between python ...
1
3
0
I was trying to build an encryption program in python 2.7. It would read the binary from a file and then use a key to encrypt it. However, I quickly ran into a problem. Files like image files and executables read as hex values. However, text files do not using open(). Even if i run file=open("myfile.txt", "rb") out=fi...
Python read text file as binary?
0.066568
0
0
8,188
30,564,015
2015-06-01T00:10:00.000
8
0
0
0
python,distribution,point
30,564,059
7
false
0
0
FIRST ANSWER: An easy solution would be to do a check to see if the result satisfies your equation before proceeding. Generate x, y (there are ways to randomize into a select range) Check if ((x−500)^2 + (y−500)^2 < 250000) is true if not, regenerate. The only downside would be inefficiency. SECOND ANSWER: OR, you coul...
1
14
1
I am wondering how i could generate random numbers that appear in a circular distribution. I am able to generate random points in a rectangular distribution such that the points are generated within the square of (0 <= x < 1000, 0 <= y < 1000): How would i go upon to generate the points within a circle such that: (...
How to generate random points in a circular distribution
1
0
0
31,584
30,565,431
2015-06-01T03:57:00.000
2
0
0
0
python,amazon-web-services,websocket,webserver,amazon-elastic-beanstalk
30,565,453
1
true
1
0
AWS doesn't "know" anything about your content. The webserver that you install will be configured to point to the "root" directory in which index.html (or something equivalent) should be. Since it depends on which webserver (django, flask, Jinja etc) you install - you should lookup its documentation!
1
1
0
I'm deploying an python web server on AWS now and I have a some question about it. I'm using websocket to communicate between back end and front end. Do I have to use framework like django or flask? If not, where should I put the index.html file? in other word, after deploying, how do AWS know the default page of my a...
Deploy python web server on AWS Elastic Beanstalk
1.2
0
0
284
30,565,824
2015-06-01T04:53:00.000
1
1
0
0
python,polling,remote-server
30,566,324
1
true
0
0
There are so many options. 'Polling' is generally a bad idea, as it assumes CPU occupation. You could have your script send you status changes. You could have your script write it's actual status into a (remote) file (wither overwriting or appending to a log file) and you can look into that file. This is probably the...
1
0
0
I'm looking for a best way to invoke a python script on a remote server and poll the status and fetch the output. It is preferable for me to have this implementation also in python. The python script takes a very long time to execute and I want to poll the status intermediately on what all actions are being performed. ...
Invoke a python script on a remote server and poll the status
1.2
0
1
235
30,567,284
2015-06-01T06:48:00.000
1
0
0
0
python,http,cron,connection,monitor
30,567,385
2
true
0
0
I would suggest just a GET request (you just need a ping to indicate that the PC is on) sent periodically to maybe a Django server and if you query a page on the Django server, it shows a webpage indicating the status of each. In the Django server have a loop where the time each GET is received is indicated, if the tim...
1
1
0
I have two PCs and I want to monitor the Internet connectivity in both of them and make it available in a page as to whether they're currently online and running. How can I do that? I'm thinking of a cron job that gets executed every minute that sends a POST to a file located in a server, which in turn would write the ...
How to monitor the Internet connectivity on two PCs simultaneously?
1.2
0
1
80
30,568,433
2015-06-01T08:00:00.000
1
0
1
0
python,tarfile
30,568,538
1
true
0
0
Internal structure. tar stands for "tape archive", and the big design point is the ability to work sequentially with small RAM, while writing to (or reading from) a sequential-access IO device (also known as tape): loading everything into memory and then processing it in some specific order was not possible. Thus, file...
1
0
0
I have a simple question yet I didn't manage to find a lot of information about it or understand it very well. When I open a tarfile in python using the tarfile.open() method, how exactly are the files in the tarfile read? I have a tarfile with data on people, each person has his own folder and in that folder his data...
Order of opening files when using tarfile.open() in Python
1.2
0
0
293
30,568,605
2015-06-01T08:11:00.000
2
0
1
0
python,python-2.7,pycharm,anaconda
30,578,236
1
true
0
0
Anaconda installs a completely separate Python, so there is no need to do anything with the old one. The Anaconda installer sets the PATH variable automatically. As to the packages, your best bet if there is a package you need that doesn't come with Anaconda is to install it with conda, or using pip if it isn't availa...
1
2
0
Currently I have python 2.7 installed, and I decided to install Anaconda (same version). My questions are: What is the safest way to do it? Uninstall python 2.7 first? Can I move packages installed on my old python version manually (without reinstalling them again)? Should I change something in my PATH variable after...
installing Anaconda on windows
1.2
0
0
1,408
30,568,702
2015-06-01T08:17:00.000
1
0
0
1
python,google-app-engine,flask,google-authentication,google-app-engine-python
30,570,660
1
false
1
0
You can't reuse the Users service authentication across different applications. A possible solution could be using a OAuth2 (or a similar mechanism) - create an application (or use one of you existing applications) which will be the authentication provider. Each application will redirect to the authentication provider ...
1
0
0
Let's say I run two different apps on different domains, coded in Python flask and running as GAE instances; one is site.co.uk and one is site.us. If I use the GAE authentication on one site is it possible to have them authenticated for the other site too? I don't really want to make them have to authenticate for each ...
GAE - Share user authentication across apps
0.197375
0
0
51
30,575,409
2015-06-01T13:53:00.000
1
0
0
0
python,django,django-queryset
30,579,869
1
true
1
0
You can reload each object in the start of the loop body. Just use TheModel.objects.get(pk=curr_instance.pk) to do this.
1
0
0
I have a queryset which I iterate through in a loop. I use data from the queryset to change data inside the queryset which might be needed in a lter step of the loop. Now the queryset is only loaded once at the beginning of the loop. How can I make django reload the data in every iteration?
Django how to not use cached queryset while iterating?
1.2
0
0
49
30,577,055
2015-06-01T15:11:00.000
3
0
1
0
python,multithreading,python-multithreading,python-multiprocessing
30,577,516
1
true
0
0
The actual limitation is a CPython limitation, not a language one. Given that, threading can be used to run concurrent tasks, as long as (in CPython) only one task has python code. Besides IO, an example would be c extensions that perform lengthy computations and release the GIL (in CPython's case).
1
2
0
I'm trying to get my head around this question. I did some research and found out that the multithreading a task would be lot slower than sequential task. The same is mentioned by respected David Beazley in some of his concurrency tasks. To achieve similar (kind of) behavior I can spawn a new process using multiprocess...
What is the use of threading in Python despite of the limitations imposed by GIL?
1.2
0
0
303
30,579,022
2015-06-01T16:54:00.000
1
0
1
0
python,multithreading
30,584,402
2
false
0
0
As far as I know, I don't believe there's a way to retrieve the thread by its thread_id. Your best bet would be to store a reference to the thread object itself.
1
1
0
I have a multithreading Python(2.7) program, which runs multiple threads for different tasks. I am storing the thread-ids, for tracking the status of threads in a separate thread for status-tracking. How can I check the thread is alive or not ( isAlive() ) by having the thread-id ?
python: Check status of thread by ID
0.099668
0
0
1,081
30,579,494
2015-06-01T17:23:00.000
-1
1
0
0
python,p2p
30,579,803
1
false
0
0
I think the simpliest way to do this is reading socket server in this battleship game. But here is a problem, in this case you will have a problem with connecting, in case when your ip is invisible from the internet.
1
0
0
this is a conceptual question. As part hobby, part art project I'm looking to build a Python script that allows two people to play battleships between their computers (across the net, without being on the same network). The idea would be you could run the program something like: python battleships.py 192.168.1.1 Where ...
Conceptual: how to code battleships between two computers in Python?
-0.197375
0
0
282
30,580,929
2015-06-01T18:46:00.000
0
0
0
0
python,class,tree,nodes
30,581,078
4
false
0
0
Pretty much both of your solutions are what is done in practice. Your first solution is to just increment a number will give you uniqueness, as long as you don't overflow (with python bigintegers this isnt really a problem). The disadvantage of this approach is if you start doing concurrency you have to make sure you u...
1
2
0
I am making a class in Python that relates a lot of nodes and edges together. I also have other operations that can take two separate objects and merge them into a single object of the same type, and so on. However, I need a way to give every node a unique ID for easy lookup. Is there a "proper way" to do this, or do I...
Giving unique IDs to all nodes?
0
0
1
1,452
30,581,807
2015-06-01T19:36:00.000
0
0
1
0
python,multithreading
30,582,034
2
false
0
0
If you want your app to be really multithreaded then consider using standalone queue (like activemq or zeromq) and consume it from your scripts running in different os processes because of GIL (with standalone queue it is very easy even to use it in network - plus to scalability).
1
4
0
I want to write a script which consumes data over the internet and places the data which is pulled every n number of seconds in to a queue/list, then I will have x number of threads which I will create at the start of the script that will pick up and process data as it is added to the queue. My questions are: How can ...
Having a global queue (or list) that is available to all threads
0
0
1
1,389
30,590,085
2015-06-02T07:36:00.000
4
0
1
0
python,django
30,590,516
2
true
1
0
Django app is actually a python package that follows the Django convention. Django-admin startapp is just a helper command to create the files in that convention. If you want to create an app without using startapp, then can create a folder and create __init__.py file and create the necessary files(for views and models...
2
1
0
If I create a normal python package (with __init__.py), instead of manage.py startapp won't I still be able to use it like a django app.?
How is a django app different from a python package?
1.2
0
0
55
30,590,085
2015-06-02T07:36:00.000
1
0
1
0
python,django
30,590,448
2
false
1
0
Yes, you will be able to use it as a django app. Django is a web framework, hence its main aim is to allow their users to focus on their applications rather than to make them hard-code every single bit of information.
2
1
0
If I create a normal python package (with __init__.py), instead of manage.py startapp won't I still be able to use it like a django app.?
How is a django app different from a python package?
0.099668
0
0
55
30,590,100
2015-06-02T07:37:00.000
1
0
0
0
python,robotframework
30,597,578
3
false
1
0
You want to add top-level metadata. And that metadata would be an HTML link. Create a suit setup for the master suite (create a file called __init__.robot in the parent test folder) And in it: *** Settings *** Documentation The main init phase for all robot framework tests. Suite Setup Setup *** Keywords *** ...
1
2
0
How can I customize my robot framework log.html and output so that I can add some external links to my output files like log.html and output.xml file.
How to add some external links to ROBOT Framework Test Statistics in log.html and output.xml?
0.066568
0
0
2,191
30,591,965
2015-06-02T09:16:00.000
1
0
0
0
python,django,database-design
30,592,097
1
false
1
0
django.contrib.auth has groups and group permissions, so all you have to do is to define landlords and tenants groups with the appropriate permissions then on your models's save() method (or using signals or else) add your Landlord and Tenant instances to their respective groups.
1
0
0
I know how permissions/groups/user work together in a "normal" way. However, I feel incomfortable with this way to do in my case, let me explain why. In my Django models, all my users are extended with models like "Landlord" or "Tenant". Every landlord will have the same permissions, every tenant will have other same p...
Can I link Django permissions to a model class instead of User instances?
0.197375
0
0
111
30,592,411
2015-06-02T09:36:00.000
3
0
0
0
python,html,boto,bottle
30,595,791
1
false
1
0
What I have ended up doing to fix this issue is used bottle to make a url which completes the needed function. Then just made an html button that links to the relevant url.
1
1
0
I'm currently trying to right a python script that overnight turns off all of our EC2 instances then in the morning my QA team can go to a webpage and press a button to turn the instances back on. I have written my python script that turns the severs off using boto. I also have a function which when ran turns them bac...
html buttons calling python functions using bottle
0.53705
0
1
617
30,595,908
2015-06-02T12:20:00.000
1
0
0
0
python,user-interface,events,kivy
56,684,592
3
false
0
1
I've dealt with similar problem and creating new thread didn't do the trick. I had to use Clock.schedule_once(new_func) function. It schedules function call to the next frame, so it is going to run almost immediately after callback ends.
1
9
0
I am writing a Kivy UI for cmd line utility I have developed. Everything works fine, but some of the processes can take from a few seconds to a few minutes to process and I would like to provide some indication to the user that the process is running. Ideally, this would be in the form of a spinning wheel or loading ba...
Building a simple progress bar or loading animation in Kivy?
0.066568
0
0
12,311
30,596,353
2015-06-02T12:38:00.000
1
0
1
0
python,python-3.x,pyside
38,494,564
1
false
0
0
Right-click the file, click properties, under general it says "opens with:"... Click the "Change" button to the right of that, and then click more options. On that menu there should be an option called "pythonw" click that. Then on the bottom-right click "apply", then "OK". Then just double-click on the file and it sho...
1
1
0
Someone gave me a python file to open and use as a resource. The only issue is I don't know anything about python, it's very different from my basic knowledge of coding. The file is not a normal .py file, but rather a console-less .pyw file. I have imported the newest version of python and installed PySide, but I have...
How to open PYW files in Windows 8
0.197375
0
0
3,111
30,600,487
2015-06-02T15:35:00.000
0
0
1
0
python,class
30,694,447
3
false
0
0
If the search method you are talking about is really so specific and you will never need to reuse it somewhere else, I do not see any reason to make it static. The fact that it doesn't require access to instance variables doesn't make it static by definition. If there is a possibility, that this method is going to be r...
2
5
0
In Python, I have a class that I've built. However, there is one method where I apply a rather specific type of substring-search procedure. This procedure could be a standalone function by itself (it just requires a needle a haystack string), but it feels odd to have the function outside the class, because my class dep...
Where is the best place to put support functions in a class?
0
0
0
659
30,600,487
2015-06-02T15:35:00.000
0
0
1
0
python,class
30,601,234
3
false
0
0
If you can think or any reason to override this function one day, make it a staticmethod, else a plain function is just ok - FWIW, your class probably depends on much more than this simple function. And if you cannot think of any reason for anyone else to ever use this function, keep it in the same module as your class...
2
5
0
In Python, I have a class that I've built. However, there is one method where I apply a rather specific type of substring-search procedure. This procedure could be a standalone function by itself (it just requires a needle a haystack string), but it feels odd to have the function outside the class, because my class dep...
Where is the best place to put support functions in a class?
0
0
0
659
30,603,175
2015-06-02T17:52:00.000
1
0
1
1
python,python-2.7,python-3.x
30,603,317
2
true
0
0
Minor versions of python are mostly backwards compatible, however major versions do not maintain backwards compatibility. There are many libraries that work with both, but the language itself does not make that guarantee.
2
1
0
I am deciding whether to install python 3.4 or 2.7 on my home server running Ubuntu Server 14.04.2. I want to ensure that it has support from all the most used python libraries (scipy, numpy, requests, etc) but I am not sure how many of these packages fully support 3.4. Do all 2.7 packages work on 3.4? If no, what are ...
Is Python 3.4 backwards compatible for 2.7 programs/libraries?
1.2
0
0
2,376
30,603,175
2015-06-02T17:52:00.000
4
0
1
1
python,python-2.7,python-3.x
30,603,204
2
false
0
0
No, only packages specifically written to support both Python 2 and 3 will run on either. It is possible to write polyglot Python, but this requires effort from the library author. Code written for Python 2.7 will not automatically work on Python 3.
2
1
0
I am deciding whether to install python 3.4 or 2.7 on my home server running Ubuntu Server 14.04.2. I want to ensure that it has support from all the most used python libraries (scipy, numpy, requests, etc) but I am not sure how many of these packages fully support 3.4. Do all 2.7 packages work on 3.4? If no, what are ...
Is Python 3.4 backwards compatible for 2.7 programs/libraries?
0.379949
0
0
2,376
30,603,407
2015-06-02T18:05:00.000
4
0
0
0
python,ibm-cloud
30,603,436
3
false
1
0
The cause for this problem was that I was not correctly telling my Python app the needed configuration information when I pushed it out to Bluemix. What I ended up having to do was add a requirements.txt file and a Procfile file into the root directory of my Python application, to draw that connection between my Python...
1
2
0
My Python app needs web.py to run but I'm unable to figure out how to get it up to bluemix. I see no options using cf push. I tried to "import web" and added some additional code to my app without success. When I push my Python app to bluemix without web.py it fails (naturally) since it does not have what it needs to r...
How to import a 3rd party Python library into Bluemix?
0.26052
0
0
1,450
30,605,118
2015-06-02T19:39:00.000
0
0
1
0
python,python-2.7
30,605,397
1
false
0
0
You can have the pexpect module in the directory where you have the tool.py and the import should work just fine.
1
1
0
I have a python script meant to run as a standalone tool invoked via: python tool.py This requirement for this tool is that it remain a standalone script. The issue I'm running into is that I'm replying heavily on a module, namely pexpect, and since it's not part of the standard python library I can't ask users to inst...
How to embed python module in a script
0
0
0
1,101
30,610,850
2015-06-03T04:28:00.000
0
0
0
1
python,python-2.7,flask,tornado,bottle
32,857,200
1
false
1
0
I would recommend you use a separate process for your app that will receive REST commands (use Pyramid or Flask), and have it send messages over RabbitMQ to the real time part. I like Kombu myself for interfacing with RabbitMQ, and your message bus will nicely decouple your web/rest needs from your event driven needs. ...
1
0
0
I am working on a Python 2.7 project with a simple event loop that checks a variety of data sources (rabbitmq, mongodb, postgres, etc) for new data, processes the data and writes data to the next stage. I would like to embed a web server in the application so it can receive simple REST commands, for shutting it down,...
Python Embed Web Server in Data Processing Node
0
0
0
124
30,610,892
2015-06-03T04:31:00.000
5
1
1
0
python,api,github
30,612,182
1
true
0
0
Why do you need to post your API key? Why not post your app code to Github without your API key and have a configuration parameter for your users to add their own API key?
1
7
0
I'm writing a Python application that utilizes the Tumblr API and was wondering how I would go about hiding, or encrypting, the API key. Github warns against pushing this information to a repo, so how would I make the application available to the public and still follow that policy?
API key encryption for Github?
1.2
0
0
248
30,611,649
2015-06-03T05:39:00.000
0
0
0
1
python
30,611,798
1
false
0
0
The good part is: you have read access on the script. What you need is a python installation on your local machine and preferably a drive letter mapping to the script's folder. If not already mapped, this can be scripted with net use <letter>: \\<remote host>\<shared folder>. Then it's as easy as cd <letter>:\<path>\ ;...
1
1
0
I've a python script in the network machine, I can open the network through explorer and have access to the script. Through that script from network,I want to create some folders/files and write/read some files in my localhost. Is there a way to do this in python?
How to run python from a network machine to local host?
0
0
1
2,012
30,613,811
2015-06-03T07:42:00.000
0
0
1
0
python,regex,quotes
30,648,960
1
false
0
0
not sure i understood exactly what you wanted but it is possible to reuse the value of captured group in a regex. may the following pattern do the job: (['"])(.*)\1 explanation: (['"]) : a quote or double-quote is captured as first group (.*) : the second group captures everything... \1 : ...until the first group val...
1
0
0
I have a regex that extracts everything between 2 double quotes and another regex that does the same for 2 single quotes. The strings within the quotes can include escaped quotes. I'd like to make these 2 expressions into a single one: 1) re.findall(r'"(.*?)(?<!\)"', string) 2) re.findall(r"'(.*?)(?<!\)'", string...
python combining 2 regexes that search strings within single and double quotes
0
0
0
75
30,614,994
2015-06-03T08:41:00.000
0
0
0
0
python,matplotlib,sublimetext
30,615,424
1
false
0
0
How about saving your figure to a file with plt.savefig("fig.png")? If you open that file with your image viewer it will be updated after running your program.
1
0
0
I've been using the IEP from pyzo before trying out Sublime Text (ST). There is an annoying behaviour with ST that IEP doesn't have. In IEP, much like with Matlab or Octave, the editor and the interactive console talk to each other. Typically if you compute some_stuff and plot it in a script, after execution of this sc...
How to update existing matplotlib (python) figures with sublime text
0
0
0
112
30,615,160
2015-06-03T08:49:00.000
3
0
1
0
python,logic,pseudocode,mathematical-expressions
30,615,220
2
true
0
0
It usually means store the value 0 on the variable p In python it would be p = 0
2
0
0
I have pseudo code am trying to implement in python but I cant seem to remember what p ← 0 would mean in logic or calculus.
Mathematical expressions in pseudo code
1.2
0
0
207
30,615,160
2015-06-03T08:49:00.000
1
0
1
0
python,logic,pseudocode,mathematical-expressions
30,615,247
2
false
0
0
It is equivalent to the assignment operator, p <- 0 in python is expressed as p = 0.
2
0
0
I have pseudo code am trying to implement in python but I cant seem to remember what p ← 0 would mean in logic or calculus.
Mathematical expressions in pseudo code
0.099668
0
0
207
30,615,536
2015-06-03T09:06:00.000
0
0
1
0
python,algorithm,iterator,permutation
30,615,998
2
false
0
0
This is a generic issue and rather not a Python-specific. In most languages, even when iterators are used for using structures, the whole structure is kept in memory. So, iterators are mainly used as "functional" tools and not as "memory-optimization" tools. In python, a lot of people end up using a lot of memory due ...
1
6
1
I'd like to create a random permutation of the numbers [1,2,...,N] where N is a big number. So I don't want to store all elements of the permutation in memory, but rather iterate over the elements of my particular permutation without holding former values in memory. Any idea how to do that in Python?
Generate random permutation of huge list (in Python)
0
0
0
1,933
30,616,967
2015-06-03T10:05:00.000
1
0
1
0
python,data-structures,pickle
30,617,635
1
true
0
0
how did you serialize the data? (pickle/json/...) also note that elements in a dictionary are not sorted (except if you used a collections.OrderedDict). so retrieving a range of elements may not give what you expect. if the amount of data you are trying to handle exceeds the memory wouldn't it be better to use some kin...
1
0
0
I have a very huge dictionary that is serialized in the hard disk. I don't have enough memory to load it completely in memory. I need to read only a particular range of the dictionary (say 100th - 200th element in the dictionary). Is it possible to load only these elements from the file? Note that the keys and values ...
Is it possible to load a particular range of a serialized python dictonary from hard disk?
1.2
0
0
24
30,618,064
2015-06-03T10:54:00.000
0
0
1
0
ipython-notebook
30,618,159
1
false
0
0
By command mode? IPython has a set of predefined ‘magic functions’ that you can call with a command line style syntax. There are two kinds of magics, line-oriented and cell-oriented. Line magics are prefixed with the % character and work much like OS command-line calls: they get as an argument the rest of the line, whe...
1
1
0
I've run an IPython cell and it seems to take a long time. Is there a way to attach to this running kernel? I'd like to see the values of the current loop iteration variable while the cell still has not finished.
How to see variables of running IPython cell?
0
0
0
64
30,619,740
2015-06-03T12:10:00.000
-1
0
0
0
python,audio,wav,wave,downsampling
65,321,335
6
false
1
0
First, you need to import 'librosa' library Use 'librosa.load' to resample the audio file librosa.load(path,sr) initiallly sr(sampling rate) = 22050.If you want to preserve native sampling rate make sr=None. otherwise the audio will be resampled to the sampling rate provided
1
24
0
I have to downsample a wav file from 44100Hz to 16000Hz without using any external Python libraries, so preferably wave and/or audioop. I tried just changing the wav files framerate to 16000 by using setframerate function but that just slows down the entire recording. How can I just downsample the audio file to 16kHz a...
Downsampling wav audio file
-0.033321
0
0
66,340
30,625,748
2015-06-03T16:29:00.000
0
1
0
0
python,ruby-on-rails,session
31,658,762
1
true
1
0
Sorry for the delay, I have the asnwer of my question: I captured the HTTP traffic of some python and ruby on rails applications, the most common sessions ids for each language are the following: -Python: sessionid -Ruby on Rails: The format of session id is: ` _{Name of application}_session For example, for my "E...
1
0
0
I want to know the names of session identifiers for Python and Ruby, for example, the names of session identifier for J2EE is JSESSIONID, for PHP is PHPSESSID. Can you help me please?
What are the names of session ids for Python and Ruby?
1.2
0
0
129
30,626,789
2015-06-03T17:25:00.000
0
0
1
0
python,windows,vba,dll,com
30,715,150
1
true
0
0
well the -- unregister command works well for unregistering COM objects , but -- debug is more usable in this position , when someone wants to modify the code. Also if you keep getting the Old instance of the COM object just restart the programs , and it'll detect the new changed code. The -- debug command will produc...
1
0
0
I'm developing a very simple COM server for educational purpose. I can get it to work but every time i have to change anything (code/logic) , i have to delete every instance of the COM Server Name in the regedit.exe under various headings till it disappears from the PythonWin >> Tools Menu >> Python COM Server Browser....
How to unregister Python COM server
1.2
0
0
831
30,631,062
2015-06-03T21:25:00.000
1
0
0
0
python,html,css,django
30,631,241
3
false
1
0
You can do this is many ways. In general you need to return some variable from your view to the html and depending on this variable select a style sheet, if your variable name will match you style sheet's name you can do "{{variable}}.css", if not you can use JQuery.
1
4
0
Sorry in advance if there is an obvious answer to this, I'm still learning the ropes with Django. I'm creating a website which has 6 pre determined subjects (not stored in DB) english, civics, literature, language, history, bible each subject is going to be associated with a unique color. I've got a template for a subj...
Changing css styles from view in Django
0.066568
0
0
6,764
30,631,885
2015-06-03T22:27:00.000
1
0
1
0
python,zip,ziparchive,openpyxl
30,635,916
1
false
0
0
openpyxl does not modify the files in place because you can't do this with zipfiles. You must extract, modify and archive. We just hide this process in the library.
1
0
0
I've been told in the past that there is simply no easy way to write a string a zip file. It's okay to READ from a zip archive, but if you want to write to a zip file, the best option is to extract it, make the changes, and then zip it back up again. However, the library I am using (openpyxl) accomplishes the feat of w...
Writing data to a zip archive in Python
0.197375
0
0
226
30,632,089
2015-06-03T22:40:00.000
0
0
1
0
python,pdf,reportlab
31,349,780
2
false
0
0
The python program img2pdf will store images into PDFs (it might not work on some PNGs, though), and there are several n-up examples in Python for putting multiple images on a page. My own library pdfrw has a 4-up example script with it. (The generic term for n-up for printing purposes is "page imposition", so that i...
1
1
0
I am relatively new to the Python-PDF relationship. If I had a list of .PNG files/pictures, how would I go about creating a PDF document with these files/pictures? And is it possible to have, for example, 4 per page? I would not need any other formatting... the requirement is very basic. Thanks
Python Multiple .PNG Files per PDF Page
0
0
0
1,725
30,632,560
2015-06-03T23:27:00.000
3
0
1
0
python,multithreading,timer
30,632,605
2
false
0
0
sleep() does not guarantee scheduling after the time given. It just guarantees to sleep at least this time. It can very well sleep longer, depending on system load. Just compare against the system time from time.time (or time.clock, depends on OS - read the notes in the documentation). after wakeup and use sleep() just...
2
0
0
I'm using wxpython and threading module of python to build a simple timer with GUI. I used time.slee(0.5) to measure the time. The problem is: Once I start the timer and switch to other program like chrome. Some times later when I switched back, the time displayed on my timer is very inaccurate. For example, if I set 3...
how to solve "when python script is running in background, the time.sleep() performs very bad?"
0.291313
0
0
262
30,632,560
2015-06-03T23:27:00.000
0
0
1
0
python,multithreading,timer
30,696,303
2
false
0
0
Finally I solved this problem by using event.wait() and multiprocessing module with good resolution and low cpu usage.
2
0
0
I'm using wxpython and threading module of python to build a simple timer with GUI. I used time.slee(0.5) to measure the time. The problem is: Once I start the timer and switch to other program like chrome. Some times later when I switched back, the time displayed on my timer is very inaccurate. For example, if I set 3...
how to solve "when python script is running in background, the time.sleep() performs very bad?"
0
0
0
262
30,632,887
2015-06-04T00:07:00.000
2
1
0
0
python,paypal,oauth,payment
30,634,280
2
true
1
0
PayPal doesn't have a way for people to sign up entirely through your site, although there are some ways to facilitate the process. You'd probably have to call PayPal to get access to some of those as they are aimed primarily at larger businesses. However, don't neglect the easy/automatic assistance that PayPal gives y...
1
0
0
I'd like to be able to pay the users of my site using PayPal Mass Payment. I think this is pretty straightforward if they have a PayPal account. However, if they do not have a PayPal account, is there any way to have them sign up through my site, without leaving? Or just with a nice redirect? Whatever is least frictio...
managed paypal accounts with least friction?
1.2
0
0
47
30,632,967
2015-06-04T00:19:00.000
1
1
1
0
python,unit-testing,code-coverage
30,633,030
1
true
0
0
IMO, If current framework supports the attribute based categorization then you can separate them by adding separate categories to have separate results from old and new tests. On the other hand you can also go for multiple framework if they're supported and have no conflict of interest(E.g. asserts, test reports) by t...
1
0
0
My project has existing (relatively low-coverage; maybe 50%, and a couple of them can't actually test the result, only that the process completes) tests using Python's built-in unittest suite. I've worked with hypothesis before and I'd like to use that as well - but I'm not sure I want to throw out the existing tests. ...
Is it wise to use two completely separate unit testing suites?
1.2
0
0
25
30,638,640
2015-06-04T08:23:00.000
0
0
0
0
python,authentication,ip
30,776,062
1
false
0
0
I don't think there is a bulletproof solution, if the users are behind NAT. To differentiate those users you would need the private IP address, which you can not get on the IP level. If the users are behind NAT, you can only see the public/external IP which would be the same for all clients. You could try to get the p...
1
0
0
I have created a service login module by python. I want to limit login. The login based on failed attempts per IP address might not work well and annoy the users connected to the Internet through a local network since they'll have same external IP address. Is there a way to uniquely identify such users? Thanks a lot!
How to uniquely identify users with the same external IP address?
0
0
1
103
30,639,573
2015-06-04T09:06:00.000
4
0
1
0
python,apache-spark,pyspark,gil
30,650,255
1
true
0
0
Parallelization in pyspark is achieved by daemon.py calling os.fork() to create multiple worker processes, so there won't be GIL issues.
1
1
0
Generally python doesn't work well with multi threading because of the Global Interpreter Lock. Does this affect also pyspark applications running in multi threaded local mode (local[n])?
Are 'local[n]' pyspark applications effected by the GIL?
1.2
0
0
484
30,642,356
2015-06-04T11:12:00.000
5
0
0
0
python,pandas,dataframe
30,648,685
1
true
0
0
Generally creating a new object and binding it to a variable will allow the deletion of any object the variable previously referred to. del, mentioned in @EdChum's comment, removes both the variable and any object it referred to. This is an over-simplification, but it will serve.
1
2
1
Tips are there for dropping column and rows depending on some condition. But I want to drop the whole dataframe created in pandas. like in R : rm(dataframe) or in SQL: drop table This will help to release the ram utilization.
how to drop dataframe in pandas?
1.2
0
0
9,398
30,643,240
2015-06-04T11:57:00.000
1
0
1
0
python,multithreading,timer
30,643,353
1
true
0
0
Accuracy should match the computer clock: milliseconds. The real problem is the jobs you're running. Do they finish before the period expires? That's dependent on the job and the machine load. The Timer can't help with that.
1
4
0
I have a server application that needs to schedule functions to be called at various times during the week, with a desired accuracy of plus or minus 15 seconds, let's say. threading.Timer is the simplest solution, but I'm concerned about accuracy when using intervals of several hundred thousand seconds. Everything I ...
How accurate is python's threading.Timer over extremely long intervals (days)?
1.2
0
0
1,002
30,645,470
2015-06-04T13:43:00.000
0
0
0
0
python,kivy,gesture
30,648,659
1
false
0
1
I'm not sure that there is, not many people use the gestures. We have a gsoc project that will probably bring some improved tools for this to kivy core, though.
1
0
0
I'm wondering if there are any preloaded gestures on kivy, such as pinch, expand, etc. The examples have check, square, circle, and cross gestures. Is there a database for more?
Preloaded gestures on Kivy?
0
0
0
63
30,645,699
2015-06-04T13:53:00.000
2
0
1
0
python,regex,eclipse,logging,replace
30,645,815
1
false
0
0
Search for (^\s+)print (.*)$ Replace with $1logger.info($2) Python should complain pretty fast about all the places where a print goes over more than a single line. You'll have to fix those places manually. Note: This skips comments The alternative is to look into the source for 2to3.py which replaces print ... with pr...
1
0
0
I am trying to refactor a large source base in a company I work in. Instead of using the print function in python 2.7x I want to use the logger function. for example: print "Sample print %d" % timestamp With logger.info("Sample print %d" % timestamp) so basically, I want to remove the print , and insert what remains in...
Replace ends of string in eclipse
0.379949
0
0
35
30,646,650
2015-06-04T14:29:00.000
0
1
1
0
python,module,komodo
70,898,035
5
false
0
0
If the command Import math is present more than once you will get the error: UnboundLocalError: local variable 'math' referenced before assignment
2
6
0
I am pretty new in programming, just learning python. I'm using Komodo Edit 9.0 to write codes. So, when I write "from math import sqrt", I can use the "sqrt" function without any problem. But if I only write "import math", then "sqrt" function of that module doesn't work. What is the reason behind this? Can I fix it s...
"from math import sqrt" works but "import math" does not work. What is the reason?
0
0
0
66,714
30,646,650
2015-06-04T14:29:00.000
3
1
1
0
python,module,komodo
30,646,701
5
false
0
0
When you only use import math the sqrt function comes in under a different name: math.sqrt.
2
6
0
I am pretty new in programming, just learning python. I'm using Komodo Edit 9.0 to write codes. So, when I write "from math import sqrt", I can use the "sqrt" function without any problem. But if I only write "import math", then "sqrt" function of that module doesn't work. What is the reason behind this? Can I fix it s...
"from math import sqrt" works but "import math" does not work. What is the reason?
0.119427
0
0
66,714
30,647,336
2015-06-04T14:57:00.000
1
0
0
1
python,unix,networking,network-programming,server
30,647,917
2
true
0
0
I always found it easier to utilize a switch's 'port mirror' to copy all data in and out of the proxy's switchport to a separate port that connects to a dedicated capture box, which does the tcpdump work for you. If your switch(es) have this capability, it reduces the load on the busy proxy. If they don't, then yes, tc...
1
0
0
I have a proxy traffic server which is an extra hop on a network and is handling large quantity's of traffic. I would like to calculate the cost in seconds of how long it takes for the proxy server to handle the incoming request, process them and forward it on. I had been playing to write a python script to perform a t...
Timing packets on a traffic server
1.2
0
1
57
30,647,758
2015-06-04T15:15:00.000
1
0
0
0
python,numpy,h5py,solid-state-drive,memory-mapping
30,650,664
1
false
0
0
cat /sys/block/sda/queue/rotational is a good way of finding out if your hard drive is a SSD or a hard disk. You can also slightly change this command in order to get other useful information like cat /sys/block/sdb/queue/rotational.
1
0
1
I want to randomly access the elements of a large array (>7GB) that I load into Python as a either an HDF5 dataset (h5py.Dataset), or a memory-mapped array (numpy.memmap). If this file lives on an spinning-platter HD, these random accesses take forever, for obvious reasons. Is there a way to check (assert) that the fil...
In python, can I see if a file lives on an HD or an SSD?
0.197375
0
0
889
30,647,952
2015-06-04T15:24:00.000
0
0
1
1
python,vb.net
30,648,878
1
false
1
0
1) I am not very familiar with Python, but for the .net application you will likely want to push change notifications to it, rather than pull. The system.net.webclient.downloadstring is a request (pull). As I am not a Python developer I cannot assist in that. 3) As you are requesting data, it is possible to create som...
1
0
0
I am writing a client-server type application. The server side gathers constantly changing data from other hardware and then needs to pass it to multiple clients (say about 10) for display. The server data gathering program will be written in Python 3.4 and run on Debian. The clients will be built with VB Winforms o...
Serve dynamic data to many clients
0
0
0
29
30,649,428
2015-06-04T16:35:00.000
1
0
0
0
python,django,url-routing
30,649,463
1
true
1
0
Well, that really is not how it works. Each view is separate and is only called from the URLs that map to it. If you have shared code, you probably want to either factor it out into separate functions that you can call from each view, or use something like a template tag or context processor to add the relevant informa...
1
0
0
I was wondering how to call my index(request) function thats in views.py upon every page reload. Currently index(request) only gets called when the app originally loads. Every other page reload after that calls another function in views.py called filter_report(request). The problem I am running into is that 85% of t...
Django: call index function on page reload
1.2
0
0
519
30,654,526
2015-06-04T21:30:00.000
0
0
0
0
python,machine-learning,lda,topic-modeling,gensim
30,656,766
1
false
0
0
So, you only have 11 documents, and are trying to get 2 topics out of them? Maybe it could be the case of not having enough data but try iterating more. BTW, is the negative log-likelihood or the perplexity going down after each iteration? Just looking at the results, I think if you iterate more, you will get the righ...
1
0
0
so I am relatively new working with gensim and LDA, started about two weeks ago and I am having trouble trusting these results. The following are the topics produced by using 11 1-paragraph documents. topic #0 (0.500): 0.059*island + 0.059*world + 0.057*computers + 0.056*presidential + 0.053*post + 0.047*posts + 0.046...
LDA generated topics
0
0
0
118
30,655,378
2015-06-04T22:35:00.000
0
0
1
0
python,arrays,numpy,multidimensional-array,netcdf
30,713,394
1
false
0
0
After talking to a few people where I work we came up with this solution: First we made an array of zeroes using the following argument: array1=np.zeros((28,5,24,4)) Then appended this array by specifying where in the array we wanted to change: array1[:,0,0,0]=list1 This inserted the values of the list into the first e...
1
0
1
This question has potentially two parts but maybe only one if the first part can be encapsulated by the second. I am using python with numpy and netCDF4 First: I have four lists of different variable values (hereafter referred to elevation values) each of which has a length of 28. These four lists are one set of 5 diff...
Creating and Storing Multi-Dimensional Array in a netCDF File
0
0
0
1,886
30,655,876
2015-06-04T23:27:00.000
0
0
1
0
python,powershell,virtualenv,virtualenvwrapper
47,241,664
4
false
0
0
I had the same issue today on a fresh win 10 system. For some reason the VirtualEnvWrapper seems to create a User folder in the site-packages folder inside your Python installation, where it can't be found. Just moving the "Modules" with all its content did the trick. -> (in my case from:) C:\Program Files (x86)\Python...
1
3
0
I have python 2.7 installed perfectly, and also pip, and I have been running the PowerShell as admin. I did: pip install virtualenv and pip install virtualenvwrapper-powershell and they both were succesfull. I also did this: mkdir '~.virtualenvs' However, whenever I try to: Import-Module virtualenvwrapper it always ...
Error importing virtualenvwrapper to the Powershell
0
0
0
3,039
30,656,968
2015-06-05T01:34:00.000
1
0
1
0
python,visual-studio-2013,msdn
30,663,455
2
false
0
0
To clean up the installation, you can just delete its installation folder and restart VS. In case you would like to be extra careful, you can run devenv.exe /setup from a VS command prompt before restarting Let me know if that works for you.
2
1
0
Please help.I cant install python tools on visual studio 2013. The installer works fine but towards end of installation it says "cannot find one or more components please reinstall the application.And the installer closes with an error message "installation stopped prematurely". Ive already tired devnav/resetuserdata.
cannot find one or more components. please reinstall application error while installing python tools
0.099668
0
0
1,588
30,656,968
2015-06-05T01:34:00.000
0
0
1
0
python,visual-studio-2013,msdn
68,296,663
2
false
0
0
I had the same issue, tried almost all the tricks but none worked out. In the end I re-installed the latest version of VS, repaired the old version and the issue was resolved.
2
1
0
Please help.I cant install python tools on visual studio 2013. The installer works fine but towards end of installation it says "cannot find one or more components please reinstall the application.And the installer closes with an error message "installation stopped prematurely". Ive already tired devnav/resetuserdata.
cannot find one or more components. please reinstall application error while installing python tools
0
0
0
1,588
30,658,172
2015-06-05T04:05:00.000
1
0
1
0
python,sequence
30,658,283
1
false
0
0
Ok, so from what you are saying, it seems like you have a f: Z_10 x Z_10 -> Z_10 A good way to represent this function is to use a dictionary data structure to hold the values. Then iterate over the sequence (most likely a list), and take each element and it's successor in the sequence and use it to index into the di...
1
0
0
I want the program to take blocks of numbers from a numeric sequence (which I enter, could be 1000 numbers). Each two numbers equals one number. For example: the numbers 8,9 in a row equal 1. Then numbers 4,8 equal 6, it goes on. Each number from 0-9 paired with another number from 0-9 has its own value. say th...
Transforming number groups
0.197375
0
0
32
30,662,065
2015-06-05T08:42:00.000
3
0
0
0
python,numpy
30,662,556
1
true
0
0
You can use gnumpy.concatenate. For 1D arrays you need to reshape to 2D first.
1
1
1
I want to transfer python codes in CPU to GPU, but I failed to find the numpy function hstack in gnumpy. Who can give me some hints to implement adding some extra rows to a existing matrix(garray) like hstack in numpy. Thank you.
Is there any implementation of hstack in gnumpy
1.2
0
0
75
30,665,447
2015-06-05T11:31:00.000
1
0
0
0
python,csv,pandas
30,667,520
1
false
0
0
In pandas.read_csv you can use the "chunksize" option, if you do, the object returned by pandas will be an iterator (of type TextFileReader) which when iterated over will return a DataFrame reading over number_of_rows<=chunksize (I hadn't realized the option existed until I read the source code...).
1
1
1
I've compared the built-in csv reader with Pandas's read_csv. The former is significantly slower. However, I have a need to stream csv files due to memory limitation. What streaming csv reader that is as fast or almost as fast as Pandas?
What is the fastest way to stream a large csv file?
0.197375
0
0
1,231
30,667,534
2015-06-05T13:15:00.000
1
0
1
0
python,visual-studio-2013,ironpython,openpyxl
30,673,230
1
true
0
0
openpyxl does not work with IronPython. But that should not affect using it with VisualStudio. Presumably you need to set the path for the project.
1
2
0
I have installed openpyxl. Working through the examples in Idle, I encounter no issues. Trying to use my VisualStudio python editor, module imports fail. Does openpyxl need to be added to IronPython for this to work? If so, how?
Python module imports Visual Studio
1.2
0
0
2,102