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
33,227,369
2015-10-20T03:15:00.000
0
0
0
0
python,arrays,numpy,pandas,resize
33,228,345
1
false
0
0
If you want to stay within 'Pandas', I would suggest one of the following: df.unstack() which would result in shape (len(index2), maxlen * num_columns) following your notation; here columns will be stored as a MultiIndex. Alternatively, you can use df.to_panel(); Panel is a natural Pandas data structure used for 3 dime...
1
0
1
I have a dataframe with two indexes. (Both timestamps but thats probably not relevant). I need to get out a numpy matrix with shape (len(first_index), maxlen, num_columns). maxlen is some number (likely the max of all of the len(second_index)) or just something simple like 1000. I can do this with arr = df.as_matrix(....
Pandas' version of numpy.resize for efficient matrix resizing
0
0
0
1,511
33,228,905
2015-10-20T05:45:00.000
0
1
0
0
java,python,c++,python-module
33,229,221
1
false
0
0
If performance is what you are looking for, you should know that Python is 10 to 100 times slower than C++. Depending on how much performance you are looking for, you may come around by optimizing your code or use some 3rd party libraries for number crunching as scipy. Using Cython would be an option for consideration,...
1
0
0
I have an assignment every week of the heuristic problem solving course. The assignments are taking up at least 3-4 days of my week (I want to reduce this time). The questions asked in the assignment are computationally intensive and we need to give our best answer within a program execution time of 2 min. I started do...
Performance of Python with c modules
0
0
0
51
33,229,441
2015-10-20T06:26:00.000
0
0
1
0
python,path,pycharm
68,943,187
11
false
0
0
I experienced this problem after moving my project to a different root directory. None of the above solutions worked for me. I solved it by opening my entire project folder, instead of just the python file I was trying to run. And then running the file I wanted, while the entire project was loaded into PyCharm.
10
35
0
I've seen this question being asked before (at least twice), but I haven't found a solution so far, so I'll ask the question again with some more details. The Problem When I run my python main file, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage...
PyCharm tells me "Cannot start process, the working directory ... does not exist"
0
0
0
54,881
33,229,441
2015-10-20T06:26:00.000
0
0
1
0
python,path,pycharm
68,016,309
11
false
0
0
I had this problem because I renamed my project, it was "xx" I renamed it to "yy", what I did was I went through the directory of .idea in the "yy", in any of those files (all XML files) if there were the name "xx", I replaced it with "yy"
10
35
0
I've seen this question being asked before (at least twice), but I haven't found a solution so far, so I'll ask the question again with some more details. The Problem When I run my python main file, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage...
PyCharm tells me "Cannot start process, the working directory ... does not exist"
0
0
0
54,881
33,229,441
2015-10-20T06:26:00.000
3
0
1
0
python,path,pycharm
33,229,464
11
true
0
0
After testing for a bit, I've found a solution (but not an answer to why this error occurs in PyCharm): Delete the file and create it again. (Or rename or move it and create a new file with its old name, both should work.)
10
35
0
I've seen this question being asked before (at least twice), but I haven't found a solution so far, so I'll ask the question again with some more details. The Problem When I run my python main file, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage...
PyCharm tells me "Cannot start process, the working directory ... does not exist"
1.2
0
0
54,881
33,229,441
2015-10-20T06:26:00.000
1
0
1
0
python,path,pycharm
54,367,334
11
false
0
0
I was getting this same error, and the path in "edit configurations" was correct. However, this is what eventually got my code working again. 1) I commented out all of the code in my file ("ctrl" + "a" + "ctrl" + "/") 2) I commented something I knew would compile in the file. (my list of imports) 3) I ran the python fi...
10
35
0
I've seen this question being asked before (at least twice), but I haven't found a solution so far, so I'll ask the question again with some more details. The Problem When I run my python main file, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage...
PyCharm tells me "Cannot start process, the working directory ... does not exist"
0.01818
0
0
54,881
33,229,441
2015-10-20T06:26:00.000
3
0
1
0
python,path,pycharm
54,862,230
11
false
0
0
I had the same problem, mine is probably related to the explaination gave by the others, it comes from the dir .idea, files *.xml contain the variable $DIR_PROJECT$. Therefore, as the attribution of a new path didn't work, I just deleted my .idea, that is automatically loaded each time I open my project's directory. It...
10
35
0
I've seen this question being asked before (at least twice), but I haven't found a solution so far, so I'll ask the question again with some more details. The Problem When I run my python main file, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage...
PyCharm tells me "Cannot start process, the working directory ... does not exist"
0.054491
0
0
54,881
33,229,441
2015-10-20T06:26:00.000
0
0
1
0
python,path,pycharm
59,196,577
11
false
0
0
The issue kept popping up over and over in PyCharm. So I created a new project and loaded the needed script. Then I provided the directory to path and assigned the default Python version that I wanted to use... and it worked. Then I was able to finally use "execute line in console" once again.
10
35
0
I've seen this question being asked before (at least twice), but I haven't found a solution so far, so I'll ask the question again with some more details. The Problem When I run my python main file, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage...
PyCharm tells me "Cannot start process, the working directory ... does not exist"
0
0
0
54,881
33,229,441
2015-10-20T06:26:00.000
2
0
1
0
python,path,pycharm
67,854,085
11
false
0
0
Set the working directory correctly 1. File-> Settings 2. Build, Execution, Deployment -> Console -> Python Console 3. Working directory: [The path to the directory where the file you're currently working on resides.]
10
35
0
I've seen this question being asked before (at least twice), but I haven't found a solution so far, so I'll ask the question again with some more details. The Problem When I run my python main file, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage...
PyCharm tells me "Cannot start process, the working directory ... does not exist"
0.036348
0
0
54,881
33,229,441
2015-10-20T06:26:00.000
0
0
1
0
python,path,pycharm
70,729,384
11
false
0
0
In my case Run -> Edit Configuration didn't help. I've solved it changing the value of "WORKING_DIRECTORY" attribute in .idea -> workspace.xml <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/your/correct/path/here" />
10
35
0
I've seen this question being asked before (at least twice), but I haven't found a solution so far, so I'll ask the question again with some more details. The Problem When I run my python main file, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage...
PyCharm tells me "Cannot start process, the working directory ... does not exist"
0
0
0
54,881
33,229,441
2015-10-20T06:26:00.000
0
0
1
0
python,path,pycharm
70,193,943
11
false
0
0
open the qtdesigner work dictionary setting and choose your project path then click OK, don't not use the mysterious work dictionary path by default
10
35
0
I've seen this question being asked before (at least twice), but I haven't found a solution so far, so I'll ask the question again with some more details. The Problem When I run my python main file, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage...
PyCharm tells me "Cannot start process, the working directory ... does not exist"
0
0
0
54,881
33,229,441
2015-10-20T06:26:00.000
37
0
1
0
python,path,pycharm
41,593,577
11
false
0
0
It happens because when you create a file it automatically assigns the working directory to it's configuration, which of course is the one where you created it. You can change that by going into Run -> Edit Configurations. Click on the folder icon in Script path: and correct the path to the file. Click OK to save and y...
10
35
0
I've seen this question being asked before (at least twice), but I haven't found a solution so far, so I'll ask the question again with some more details. The Problem When I run my python main file, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage...
PyCharm tells me "Cannot start process, the working directory ... does not exist"
1
0
0
54,881
33,231,156
2015-10-20T08:01:00.000
0
0
0
0
python,django,selenium,selenium-webdriver
33,231,191
1
false
1
0
I suggest you use a continuous integration solution like Jenkins to run your tests periodically.
1
0
0
I'm quite new to whole Selenim thing and I have a simple question. When I run tests (Django application) on my local machine, everything works great. But how this should be done on server? There is no X, so how can I start up webdriver there? What's the common way? Thanks
Selenium on server
0
0
1
63
33,234,363
2015-10-20T10:35:00.000
3
0
0
0
python,image,opencv,image-processing,opencv-contour
42,767,296
3
false
0
0
Answer from @rayryeng is excellent! One small thing from my implementation is: The np.where() returns a tuple, which contains an array of row indices and an array of column indices. So, pts[0] includes a list of row indices, which correspond to height of the image, pts[1] includes a list of column indices, which corres...
1
15
1
I'm using OpenCV 3.0.0 on Python 2.7.9. I'm trying to track an object in a video with a still background, and estimate some of its properties. Since there can be multiple moving objects in an image, I want to be able to differentiate between them and track them individually throughout the remaining frames of the video....
Access pixel values within a contour boundary using OpenCV in Python
0.197375
0
0
32,084
33,236,054
2015-10-20T11:58:00.000
0
0
0
0
python,python-requests
33,236,211
3
true
0
0
HTTP status codes are usually meant for the browsers, or in case of APIs for the client talking to the server. For normal web sites, using status codes for semantical error information is not really useful. Overusing the status codes there could even cause the browser to not render responses correctly. So for normal HT...
2
1
0
I used requests to login to a website using the correct credentials initially. Then I tried the same with some invalid username and password. I was still getting response status of 200. I then understood that the response status tells if the corresponding webpage has been hit or not. So now my doubt is how to verify if...
How to verify that we have logged in correctly to a website using requests in python?
1.2
0
1
98
33,236,054
2015-10-20T11:58:00.000
0
0
0
0
python,python-requests
33,236,191
3
false
0
0
What status code the site responds with depends entirely on their implementation; you're more likely to get a non-200 response if you're attempting to log in to a web service. If a login attempt yielded a non-200 response on a normal website, it'd require a special handler on their end, as opposed to a 200 response wit...
2
1
0
I used requests to login to a website using the correct credentials initially. Then I tried the same with some invalid username and password. I was still getting response status of 200. I then understood that the response status tells if the corresponding webpage has been hit or not. So now my doubt is how to verify if...
How to verify that we have logged in correctly to a website using requests in python?
0
0
1
98
33,241,211
2015-10-20T15:52:00.000
6
0
0
1
python,linux,file,space
33,241,435
1
true
0
0
You don't need to (and shouldn't) escape the space in the file name. When you are working with a command line shell, you need to escape the space because that's how the shell tokenizes the command and its arguments. Python, however, is expecting a file name, so if the file name has a space, you just include the space.
1
3
0
I have problem with os.access(filename, os.R_OK) when file is an absolute path on a Linux system with space in the filename. I have tried many ways of quoting the space, from "'" + filename + "'" to filename.replace(' ', '\\ ') but it doesn't work. How can I escape the filename so my shell knows how to access it? In te...
Handling a literal space in a filename
1.2
0
0
4,377
33,243,575
2015-10-20T17:57:00.000
1
0
0
0
python,mysql,mysql-python
33,243,613
1
true
0
0
Connection instance is persistent, you can connect one time and work with connection as long as you need.
1
1
0
I'm new to using databases in Python and I'm playing around with MySQLdb. I have several methods that will issue database calls. Do I need to go through the database connection steps every time I want to make a call or is the instance of the database persistent?
Do I need to call MySQLdb.connect() in every method where I execute a database operation?
1.2
1
0
32
33,246,572
2015-10-20T20:52:00.000
0
1
0
1
python,python-2.7,fedora-21
33,246,962
2
false
0
0
Path to python was different than other user. User was pointing to canopy.
1
0
0
OS: Fedora 21 Python: 2.7.6 I run a python script as root or using sudo it runs fine. If I run it as just the user I get the following: Traceback (most recent call last): File "/home/user/dev_ad_list.py", line 12, in import ldap ImportError: No module named ldap selinux=disabled -- What other security...
Python Script not Running - Has to be something simple
0
0
0
51
33,248,482
2015-10-20T23:24:00.000
2
0
0
0
python,sql,database,postgresql
33,248,538
1
false
0
0
Double-quotes in SQL are not strings - they escape table, index, and other object names (ex. "John Smith" refers to a table named John Smith). Only single quoted strings are actually strings. In any case, if you are using query parameters properly (which, in your example code, you seem to be), you should not have to wo...
1
0
0
I have the following table create table players (name varchar(30), playerid serial primary key); And I am working with the script: def registerPlayer(name): """Registers new player.""" db = psycopg2.connect("dbname=tournament") c = db.cursor() player = "insert into players values (%s);" scores = "in...
Quotations not working in PostgreSQL Queries
0.379949
1
0
74
33,249,904
2015-10-21T02:23:00.000
0
0
0
0
python,machine-learning,scikit-learn
33,290,142
1
true
0
0
If the gap between the training and cross-validation accuracy is increasing then this is an indication that your model is overfitting on the training data. With every iteration (supplying additional training data) your model is better able to capture the training data, however it is no longer able to better generalise ...
1
0
1
I am trying to plot the learning curves for my SVC classifier with sklearn.learning_curve. From the plot, I find that both of my training scores and test scores increases simultaneously. But the gap between the training curve and cross-validation curve becomes larger with the increasing number of the samples. As I know...
About learning curves
1.2
0
0
959
33,253,287
2015-10-21T07:24:00.000
1
0
1
0
python,random
33,254,265
2
false
0
0
Unique and random are contradictory. For anything that's genuinely random there is a (small, maybe infinitessimal) chance of repetition. If you want something less unwieldy (but less universally unique) than UUIDs you can roll your own combination of a random number (with a small chance of repetition) and a number deri...
1
0
0
I have written a script where I need a unique random number every time I run that script. Just for explaination: suppose that I want my script 5 times. Now I want number generated in all times should be unique? I have found a lot of infomation about random number uniqueness but those are for one time only. If you thi...
How to generate random numbers that are unique forever in python
0.099668
0
0
334
33,261,261
2015-10-21T13:54:00.000
0
0
0
0
python,pandas,group-by
33,261,884
2
false
0
0
You need to make a dictionary, where the key is the id. Each value of that is going to be another dictionary of outN to value. Read a line. You get an id, outN, and a value. Check you have an dict for that id first, and if not, create one. Then shove the value for that outN into the dict for that id. Second step: You ...
1
2
1
I have a question per below - I need to transform multiple rows of ID into one row, and let the different "output"-values become columns with binary 1/0, like example. Here is my table! ID Output Timestamp 1 out1 1501 1 out2 1501 1 out5 1501 1 out9 1501 2 out3 ...
Python multiple rows to one row
0
0
0
1,859
33,263,378
2015-10-21T15:31:00.000
0
0
0
0
python,python-3.x,openpyxl
33,275,544
2
false
0
0
When it comes to value of numbers openpyxl doesn't care about their formatting so it will report 3142 in both cases. I don't think coercing this to a string makes any sense at all.
1
2
0
I filled an Excel sheet with a correct float numbers based on the German decimal point format. So, the number 3.142 is correctly written 3,142, and if it is written 3.142 (or '3.142 by declaring it as a text entry in order to avoid English interpretation as 3142), then I want to report an error to the author of the Exc...
How to read a cell of a sheet filled with floats containing German decimal point
0
1
0
549
33,264,119
2015-10-21T16:05:00.000
1
1
0
1
python,ssh,google-compute-engine
33,264,941
1
false
0
0
X-Windows (X11 nowadays) is a client-server architecture. You can forward connections to your x server with a -X (uppercase) option to ssh (ie $ ssh -X username@server.com). This should work if everything is installed correctly on the server (apt-get usually does a good job of this, but I don't have a lot of experience...
1
1
0
I cannot open .py file through Google VM SSH Console. Kwrite and sudo apt-get install xvfb are installed. My command: kwrite test.py I get the following error: kwrite: Cannot connect to X server. Do I need to change the command/install additional software? Thanks
Cannot open .py file in Google Virtual Machine SSH Terminal
0.197375
0
0
72
33,273,885
2015-10-22T05:22:00.000
0
1
1
0
python,api,twitter,tweepy,twitter-streaming-api
33,290,201
1
true
0
0
Once your data has been loaded into JSON format, you can access the username by calling tweet['user']['screen_name']. Where tweet is whatever varibale you have assigned that holds the JSON object for that specific tweet.
1
0
0
How to list name of users who tweeted with given keyword along with count of tweets from them ? I am using python and tweepy. I used tweepy to list JSON result in a file by filter(track["keyword"]) but doesn't know how to list users who tweeted given keyword.
how to list all users who tweeted a given keyword using twitter api and tweepy
1.2
0
1
578
33,275,042
2015-10-22T06:57:00.000
0
0
1
0
python-3.x
33,275,076
5
false
0
0
1) create a variable maxNum = 0 2) loop through list if a[i] > maxNum : maxNum = a[i] 3)loop through list a second time now if a[i] == maxNum: print(i)
1
1
0
In a list, there might be several largest numbers. I want to get the indices of them all. For example: In the list a=[1,2,3,4,5,5,5] The indices of the largest numbers are 4,5,6 I know the question is easy for most of people, but please be patient to answer my question. Thanks :-)
How to find the index of the largest numbers in a list
0
0
0
54
33,276,126
2015-10-22T08:05:00.000
-2
0
0
0
python,django,django-models,django-admin,django-grappelli
33,277,390
1
false
1
0
I think you can use a none-model class, which wrapper the Model class and have some extra fields, where you can set/get or save to other place
1
0
0
I have a model, which has some fields stored in db. On top of it, I need to implement non-db fields, which would be loaded and saved using a custom API. Users should interact with the model using the admin interface, Grappelli is used to enhance the standard Django admin. I am interested in one of the following: Model...
Non-db fields for Django model or admin
-0.379949
0
0
1,083
33,276,615
2015-10-22T08:33:00.000
3
0
1
0
python,module
33,276,690
2
false
0
0
If the script is still running, it's likely that replacing the dependency will not affect it at all - the code will already be in memory. Still, it's better to be safe than sorry. I would install the other script inside a virtualenv, in which you can install whichever versions of modules you want without affecting any...
1
1
0
Is it possible to update a python module while it is used in a running script? The situation is the following: 1) I have a script running using pandas 0.15.2. It is a long data processing task and should continue running for at least another week. 2) I would like to run, on the same machine, another script, which requi...
update python module while it is active
0.291313
0
0
48
33,279,279
2015-10-22T10:51:00.000
0
0
0
0
python,urllib
33,279,321
2
false
0
0
Using urllib you can't perform a click on an <a> tag. You may want to look into selenium-webdriver for that matter. You can fetch its href attribute value and then call the urllib.urlopen(path) function (make sure path variable contains the full path and not the relative path).
2
1
0
I'm writing a python script to grab my bank account details using urllib. To access the login page, there is a hyperlink button present on the page. How can I get my script to click that button or indeed bypass it? Please, any help me on this would be appreciated.
Python: Clicking a hyperlink button with urllib
0
0
1
1,484
33,279,279
2015-10-22T10:51:00.000
0
0
0
0
python,urllib
33,279,434
2
false
0
0
I want to add to Jason's answer that if you're going to pass login data you might want to step away from urllib and use requests. I would find the url of the page that has the login form and use requests there.
2
1
0
I'm writing a python script to grab my bank account details using urllib. To access the login page, there is a hyperlink button present on the page. How can I get my script to click that button or indeed bypass it? Please, any help me on this would be appreciated.
Python: Clicking a hyperlink button with urllib
0
0
1
1,484
33,280,111
2015-10-22T11:38:00.000
0
0
0
0
python,tkinter
44,626,762
1
false
0
1
There are three ways to insert elements in a tkinter window. First you could use only yourelement.pack() to put the element, and every element you put after, it will be downside the first align at the center. You could use yourelement.pack() and yourelement.place(x=xx,y=xx,width=xx,height=xx) to place the element where...
1
2
0
I am creating an application with Tkinter that contains a grid of widgets. Is there anyway to mimic the behavior of bootstrap such that all the elements appear on the window after it is collapsed?
Bootstrap Behavior in Tkinter
0
0
0
1,698
33,280,783
2015-10-22T12:13:00.000
2
1
0
1
python,windows,cron,crontab,job-scheduling
33,283,524
1
true
0
0
cron is best for jobs that you want to repeat periodically. For one-time jobs, use at or batch.
1
3
0
What are the best methods to set a .py file to run at one specific time in the future? Ideally, its like to do everything within a single script. Details: I often travel for business so I built a program to automatically check me in to my flights 24 hours prior to takeoff so I can board earlier. I currently am editing...
Methods to schedule a task prior to runtime
1.2
0
0
50
33,285,738
2015-10-22T16:17:00.000
0
0
0
0
python,amazon-redshift,amazon-rds
34,606,560
1
false
0
0
Currently it's impossible to access underlining db from UDF on RedShift, not supported yet.
1
1
0
I have 2 tables: Main Table Rules Reference Table(if, else if, else) I cannot join tables directly because reference tables contains if,else if condition data. Same functionality i have implemented using Distributed Cache UDF in HIVE and i want same behavior in RedShfit also. I want to apply Reference rules table for...
Accessing RedShift Table inside UDF
0
0
0
263
33,286,349
2015-10-22T16:49:00.000
-2
0
1
0
python,string
33,286,380
4
false
0
0
You can do this: print "{{f}}".format(f='wonderful'). You can do this as well: "Hello, {name}!".format(name='John'). This will substitute all {name}s with John.
1
5
0
Ponder that you have a string which looks like the following 'This string is {{}}' and you would like to transform it into the following 'This string is {wonderful}' if you do 'This string is {{}}'.format('wonderful') it won't work. What's the best way to achieve this?
string.format() with {} inside string as string
-0.099668
0
0
7,116
33,289,820
2015-10-22T20:12:00.000
0
0
1
0
python,spacy
66,596,439
5
false
0
0
from spacy.en import English may give you an error No module named 'spacy.en' All language data has been moved to a submodule spacy.lang in spacy2.0+ Please use spacy.lang.en import English Then do all the remaining steps as @syllogism_ answered
1
35
0
How can I extract noun phrases from text using spacy? I am not referring to part of speech tags. In the documentation I cannot find anything about noun phrases or regular parse trees.
Noun phrases with spacy
0
0
0
33,789
33,290,705
2015-10-22T21:03:00.000
0
0
0
0
python,amazon-s3
33,291,826
1
false
0
0
You use HTTPS. SSL certificates not only serve as a public key for encryption, they are also signed by a trusted certificate authority and confirm that the server you intended to contact possesses a certificate (and has the correlated private key) that matches the hostname you used when you made the contact. A prope...
1
0
0
I have a s3 bucket with a file in it and while retrieving file from s3 bucket, I want to check if it is retrieved from the source I am expecting from and not from some man-in-the-middle thingy. What is the best way to do that? Something with Authentication header may be or associate with key?
python : signature matching aws s3 bucket
0
0
1
60
33,290,927
2015-10-22T21:17:00.000
1
1
0
1
python,django-views,fork,uwsgi
58,931,038
1
false
1
0
use lazy-apps = true instead of 1
1
3
0
I use Debian + Nginx + Django + UWSGI. One of my function us fork() in the file view.py (the fork works well), then immediately written return render (request, ... After the fork() the page loads for a long time and after that browser prints error - "Web page not available». On the other hand the error doesn’t occur if...
How to enable the lazy-apps in uwsgi to use fork () in the code?
0.197375
0
0
2,374
33,291,027
2015-10-22T21:24:00.000
1
0
1
0
python,regex,python-2.7,python-3.x
33,291,521
3
false
0
0
The reason for your issue is a combination of greediness and the empty token. The reason why is that when the pattern starts out, it will happily match the ab at the beginning of the string. So the first token is satisfied. Now the next token is the greedy dot. This consumes all of the remaining characters in your targ...
2
0
0
As I understand, | tries different subpatterns in alternation and matches the first possible option. Whenever there are multiple groups, the later ones behave unexpectedly when one of the subpatterns is empty giving it priority. Example: re.search("(ab|a|).*(as|a|).*(qwe|qw|)", "abcde asdfg qwerty").groups() returns: (...
Empty string taking precedence in python regex subpatterns with multiple groups
0.066568
0
0
85
33,291,027
2015-10-22T21:24:00.000
1
0
1
0
python,regex,python-2.7,python-3.x
33,291,201
3
false
0
0
The reason that you're getting that middle group is the .* is greedy. It sees all characters in your string and consumes all of them. You probably want something like this: (ab|a|).* ?(as|a|).* (qwe|qw|) It might be more helpful if you posted exactly what you need. I'm not sure what the use case of this might be, an...
2
0
0
As I understand, | tries different subpatterns in alternation and matches the first possible option. Whenever there are multiple groups, the later ones behave unexpectedly when one of the subpatterns is empty giving it priority. Example: re.search("(ab|a|).*(as|a|).*(qwe|qw|)", "abcde asdfg qwerty").groups() returns: (...
Empty string taking precedence in python regex subpatterns with multiple groups
0.066568
0
0
85
33,292,063
2015-10-22T22:50:00.000
0
0
1
0
hadoop,apache-spark,ipython,pyspark,jupyter
34,088,151
1
false
0
0
I have a working deployment of CDH5.5 + jupyter with pyspark and scala native spark. In my case I am using a dedicated user to start a jupyter server and then connecting to it from a client browser. Before sharing some thoughts about your problem I would like to point out that if your fifth server is not close connecte...
1
1
1
Let's assume I've got a 4 nodes Hadoop cluster (Cloudera distro in my case) with a user named 'hadoop' on each node ('/home/hadoop'). Also, I've got a fifth server with installed on it, Jupyter and Anaconda with a user named 'ipython', but without hadoop installation. Let's say I want to start Jupyter remotely from tha...
Spark: How to start remotely Jupyter in 'yarn_client' mode from a different user
0
0
0
1,327
33,294,758
2015-10-23T04:12:00.000
0
0
0
0
javascript,python,django,cordova,authentication
33,294,839
2
false
1
0
You would need to either expose the django token in the settings file so that it can be accessed via jquery, or that decorator wont be accessible via mobile. Alternatively, you can start using something like oauth
1
1
0
I have developed a Python/Django application for a company. In this app all the employees of the company have a username and a password to login in. Now there is a need for a phone application that can do some functionality. In some functions I have the decorator @login_required For security reasons I would like to wor...
Login in from Phone App
0
0
0
57
33,295,439
2015-10-23T05:29:00.000
0
0
0
0
python,django,apache,ffmpeg,moviepy
33,412,882
2
true
1
0
After spending lots of time and trying lots of things, I have finally solved this issue. We can pass full path of temp video along with it's name, then it will create temp video at given path. Make sure you have write permissions on directory which you are going to set for temp video.
1
3
0
I am using Moviepy through a Django application on Ubuntu 14.04 system. It is giving me permissions error when it tries to write video file. Following are details of error : MoviePy error: FFMPEG encountered the following error while writing file test1TEMP_MPY_wvf_snd.mp3: test1TEMP_MPY_wvf_snd.mp3: Permission denied I...
MoviePy error: FFMPEG permission error
1.2
0
0
2,767
33,298,821
2015-10-23T09:17:00.000
0
0
0
0
python,amazon-web-services,amazon-s3,amazon-ec2,amazon-iam
33,375,622
5
false
1
0
As mentioned above, you can do this with Boto. To make it more secure and not worry about the user credentials, you could use IAM to grant the EC2 machine access to the specific bucket only. Hope that helps.
1
5
0
I have an EC2 instance and an S3 bucket in different region. The bucket contains some files that are used regularly by my EC2 instance. I want to programatically download the files on my EC2 instance (using python) Is there a way to do that?
Access to Amazon S3 Bucket from EC2 instance
0
1
1
6,069
33,302,773
2015-10-23T12:51:00.000
1
1
0
1
python,labview
33,306,025
4
false
0
0
Why not use the System Exec.vi in Connectivity->Libraries and Executables menu? You can execute the script and get the output.
2
2
0
I need to call a Python script from Labview, someone know which is the best method to do that? I've tried Labpython, but it is not supported on newest versions of Labview and I'm not able to use it on Labview-2014. Definitevly, I'm looking for an advice about python integration: I know this two solutions: 1)Labpython: ...
Python and Labview
0.049958
0
0
2,470
33,302,773
2015-10-23T12:51:00.000
0
1
0
1
python,labview
55,798,097
4
false
0
0
You can save Python script as a large string constant(or load from text file) within the LabVIEW vi so that it can be manipulated within LabVIEW and then save that to a text file then execute the Python script using command line in LabVIEW. Python yourscript enter
2
2
0
I need to call a Python script from Labview, someone know which is the best method to do that? I've tried Labpython, but it is not supported on newest versions of Labview and I'm not able to use it on Labview-2014. Definitevly, I'm looking for an advice about python integration: I know this two solutions: 1)Labpython: ...
Python and Labview
0
0
0
2,470
33,306,071
2015-10-23T15:24:00.000
0
0
0
0
python,django,django-rest-framework
68,921,035
4
false
1
0
if you get single data in array format then user .get method instead of .filter method .get instead of .filter for get single data response only
1
8
0
I am converting a set of existing APIs from tastypie to REST framework. By default when doing list APIs, tastypie returns a dictionary containing the list of objects and a dictionary of metadata, where REST framework just returns an array of objects. For example, I have a model called Site. Tastypie returns a dictionar...
Return dictionary instead of array in REST framework
0
0
0
6,333
33,306,517
2015-10-23T15:46:00.000
1
0
0
0
python,database-connection,psycopg2
33,306,596
1
true
0
0
It looks like I can do this in __del__() or make the class a context manager and close the connection in __exit__(). I wonder which one is more Pythonic. I won't comment on what's more "pythonic", since that is a highly subjective question. However, Python doesn't make very strict guarantees on when a destructor is c...
1
1
0
I create a database connection in the __init__ method of a Python class and want to make sure that the connection is closed on object destruction. It looks like I can do this in __del__() or make the class a context manager and close the connection in __exit__(). I wonder which one is more Pythonic.
What's the preferred way to close a psycopg2 connection used by Python object?
1.2
1
0
523
33,307,845
2015-10-23T17:04:00.000
1
0
0
0
python,sockets,server,client,disconnect
33,307,987
2
true
0
0
Assuming you are not after ping from server to client. I believe that your approach is fine. Very ofther server will not be able to hit client but it works otherway around. You may run out of resources if you have many connected clients. Also over this established channel you can send other data/metrics and boom monito...
1
0
0
My basic problem is that I am looking for a way for multiple clients to connect to a server over the internet, and for the server to be able to tell if those clients are online or offline. My current way of doing this is a python socket server, and python clients, which send the server a small message every 2 seconds. ...
Python client-server - tell if client offline
1.2
0
1
1,192
33,308,781
2015-10-23T18:05:00.000
1
0
0
0
python,django,python-3.x,pip,django-rest-framework
67,793,330
29
false
1
0
Also, if you're getting this error while running docker-compose up. Make sure to run docker-compose up --build because docker needs to install the djangorestframework dependency as well.
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
0.006896
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
0
0
0
0
python,django,python-3.x,pip,django-rest-framework
68,277,646
29
false
1
0
After installing the necessary packages with python3/pip3 inside my virtual environment, it all came down to running my server with python manage.py runserver instead of python3 manage.py runserver. This was because the virtual environment and other packages were installed using python3/pip3 and not python2/pip2, hence...
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
0
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
0
0
0
0
python,django,python-3.x,pip,django-rest-framework
67,944,634
29
false
1
0
I face the same problem. In my case, I solved it by update Windows Defender configuration.
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
0
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
0
0
0
0
python,django,python-3.x,pip,django-rest-framework
61,280,125
29
false
1
0
I know there is an accepted answer for this question and many other answers also but I just wanted to add an another case which happened with me was Updating the django and django rest framework to the latest versions to make them work properly without any error. So all you have to do is just uninstall both django and ...
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
0
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
2
0
0
0
python,django,python-3.x,pip,django-rest-framework
61,382,641
29
false
1
0
Yeh for me it was the python version as well ... much better to use pipenv ... create a virtual env using using python 3 ... install pipenv : pip3 install pipenv create the virtualenv: pipenv --python 3 activate the virtual env: pipenv shell
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
0.013792
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
0
0
0
0
python,django,python-3.x,pip,django-rest-framework
59,230,374
29
false
1
0
(I would assume that folks using containers know what they're doing, but here's my two cents) Let's say you setup your project using cookiecutter-django and enabled the docker container support, be sure to update the pip requirements file with djangorestframework==<x.yy.z> (or whichever python dependency you're trying ...
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
0
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
0
0
0
0
python,django,python-3.x,pip,django-rest-framework
68,626,596
29
false
1
0
Install pip3 install djangorestframework first and add rest_framework in the settings.py. This is how I have a shout out the problem.
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
0
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
5
0
0
0
python,django,python-3.x,pip,django-rest-framework
50,729,985
29
false
1
0
If you're using some sort of virtual environment do this! Exit from your virtual environment. Activate your virtual environment. After you've done this you can try running your command again and this time it probably won't have any ImportErrors.
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
0.034469
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
18
0
0
0
python,django,python-3.x,pip,django-rest-framework
52,544,748
29
false
1
0
Also, check for the possibility of a tiny typo: It's rest_framework with an underscore (_) in between! Took me a while to figure out that I was using a dash instead...
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
1
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
-1
0
0
0
python,django,python-3.x,pip,django-rest-framework
56,489,277
29
false
1
0
On Windows, with PowerShell, I had to close and reopen the console and then reactive the virtual environment.
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
-0.006896
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
1
0
0
0
python,django,python-3.x,pip,django-rest-framework
54,212,984
29
false
1
0
if you used pipenv: if you installed rest_framework thru the new pipenv, you need to run it thru the virtual environment: 1.pipenv shell 2.(env) now, run your command(for example python manage.py runserver)
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
0.006896
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
2
0
0
0
python,django,python-3.x,pip,django-rest-framework
52,474,178
29
false
1
0
If you are working with PyCharm, I found that restarting the program and closing all prompts after adding 'rest_framework' to my INSTALLED_APPS worked for me.
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
0.013792
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
1
0
0
0
python,django,python-3.x,pip,django-rest-framework
71,253,035
29
false
1
0
if after installing and adding it to your INSTALLED_APPS it persist, then it's most likely because you're using python3 to run the server and thats okay. So what you do while installing is use python3 -m pip install djangorestframework .
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
0.006896
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
0
0
0
0
python,django,python-3.x,pip,django-rest-framework
43,004,127
29
false
1
0
try this if you are using JWT pip install djangorestframework-jwt
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
0
0
0
221,940
33,308,781
2015-10-23T18:05:00.000
2
0
0
0
python,django,python-3.x,pip,django-rest-framework
38,469,924
29
false
1
0
When using a virtual environment like virtualenvwithout having django-rest-framework installed globally you might as well have the error. The solution would be: activate the environment first with {{your environment name}}/bin/activate for Linux or {{your environment name}}/Scripts/activate for Windows and then run ...
15
116
0
I've installed django rest framework using pip install djangorestframework yet I still get this error when I run "python3 manage.py sycndb": ImportError: No module named 'rest_framework' I'm using python3, is this my issue?
Django Rest Framework -- no module named rest_framework
0.013792
0
0
221,940
33,309,735
2015-10-23T19:08:00.000
1
0
1
0
python,ptvs
33,310,137
1
false
0
0
Sending it to the interactive works. Still new to VS and PTVS, so kind of a bonehead move.
1
0
0
I'm not sure how to phrase the question another way, but I upgraded from VS 13' to 15', and I'm no longer able to run multiple statements in the REPL window. I get 'SyntaxError: multiple statements found while compiling a single statement'. I know in 13' i was able to run multiple lines/statements with error. Any sugge...
How to pass multiple lines into interpreter?
0.197375
0
0
159
33,310,292
2015-10-23T19:45:00.000
2
0
0
0
python,sockets,network-programming
33,310,427
1
true
0
0
Yes, UDP sockets are bidirectional.
1
0
0
Am I able to send and receive data (therefore, to use sendto and recvfrom methods) via the same UDP socket simultaneously in Python? I need to listen for new packets while sending some data to previous clients from another thread.
Am I able to send and receive data via the same UDP socket simultaneously
1.2
0
1
583
33,310,788
2015-10-23T20:21:00.000
0
0
0
0
python,python-3.x,openpyxl
33,320,152
2
false
0
0
I suggest you update your version of openpyxl. It hasn't been a requirement to have a styles.xml in an archive for a while.
1
0
0
I have a directory of .xls and .xlsx files I am trying to load into Python with the openpyxl module. My code is as follows: for i in os.listdir(os.getcwd()): if i.endswith(".xls") or i.endswith(".xlsx"): wb = openpyxl.load_workbook(i) When I run this code I am receiving the following error: raise InvalidFil...
InvalidFileException error when iterating through directory with openpyxl.load_workbook
0
0
0
1,895
33,312,123
2015-10-23T22:08:00.000
0
0
1
0
python
33,312,656
1
true
0
0
The sys module is built in to the python interpreter and thus has higher priority over your bogus python module. Additionally, before any of your code is run, some part of the python startup has already imported the sys module and cached it in sys.modules. If a module you try to import is in the cache, the cached modul...
1
0
0
I am relatively new to python and was reading about how python goes about looking for modules when import statement is invoked. It appears that when doing stuff on the python interactive prompt, it should look for sys.py in my current working directory first when I do "import sys" but it seems to be saving me from this...
why doesnt sys.py in my current directory break "import sys"
1.2
0
0
111
33,313,496
2015-10-24T01:10:00.000
1
0
1
0
python,package,config,generated
33,313,610
1
true
0
0
I would think you would implement some kind of initialization routine that allows them to pass in the values, assuming this is a module they might import and use. If it is a package that they run from the command line, like python -m SimpleHTTPServer then you just could probably add some arguments to specify a key file...
1
1
0
I have a python package which build some particular text file, and save it on a bucket on google storage. The access keys of google storage are a parameter of my program which are defined in a file config.py, but these keys should not be given to other people and every user is expected to fill the file with its own acc...
generate individual config file for a python package
1.2
0
0
52
33,321,076
2015-10-24T17:19:00.000
0
0
0
0
python,session,cookies,python-requests
33,321,212
2
false
1
0
You need to get the response from the page then regex match for token.
2
0
0
I am trying to extract the data from webpage after log in. To log in website, i can see the token (authenticity_token) in Form Data section. It seems, token generating automatically.I am trying to get token values but no luck.Please anyone help me on this,how to get the token value while sending the post requests.
How to get token value while sending post requests
0
0
1
70
33,321,076
2015-10-24T17:19:00.000
0
0
0
0
python,session,cookies,python-requests
37,413,165
2
false
1
0
token value is stored in the cookie file..check the cookie file and extract the value from it.. for example,a cookie file after login contain jsession ID=A01~xxxxxxx where 'xxxxxxx' is the token value..extract this value..and post this value
2
0
0
I am trying to extract the data from webpage after log in. To log in website, i can see the token (authenticity_token) in Form Data section. It seems, token generating automatically.I am trying to get token values but no luck.Please anyone help me on this,how to get the token value while sending the post requests.
How to get token value while sending post requests
0
0
1
70
33,324,475
2015-10-24T23:31:00.000
2
0
0
0
python,bokeh
33,339,510
1
true
0
0
There is an open PR to improve this, it will be in the the 0.11 release.
1
3
1
Usually I do plotting inside of IPython Notebook with pylab mode. Whenever I use Bokeh, I like to enable output_notebook() to show my plot inside of the IPython notebook. Most annoying part is that Bokeh enable wheel_zoom by default which cause unintended zoom in IPython notebook. I know I can avoid this by passing com...
How to disable wheel_zoom in Bokeh?
1.2
0
0
513
33,327,217
2015-10-25T07:20:00.000
0
0
0
0
python,django,markdown,django-wiki
33,327,523
1
true
1
0
Well, it looks like there is just such an extension for this in MarkDown (WikiLinkExtension - which takes a base_url parameter). I've had to modify my copy of django-wiki to add a new setting to use it (submitted an upstream pull request for it too, since I suspect this will be useful to others). Kinda surprised django...
1
0
0
I've got a Django app that I'm working on, with a wiki (powered by django-wiki) sitting under the wiki/ folder. The problem I'm having is that if I create links using Markdown, they all direct to the root /, whereas I want any links generated from the markdown to go into the same subdirectory (under /wiki). The documen...
Defining a default URL prefix using markdown / django-wiki
1.2
0
0
226
33,328,730
2015-10-25T10:41:00.000
0
0
0
0
python,django
33,329,001
1
false
1
0
Groups in django (django.contrib.auth) are used to specify certain rights of viewing content mainly in the admin to certain users. I think your group functionality might be more custom than this and that you're better of creating your own group models, and making your own user and group management structure that suits ...
1
0
0
I am currently learning how to use Django. I want to make a web app where you as a user can join groups. These groups have content that just members of this group should be able to see. I learned about users, groups and a bit of authentication. My first impression is, that this is more about the administration of the ...
How to organize groups in Django?
0
0
0
77
33,329,238
2015-10-25T11:38:00.000
0
0
1
0
python,nlp,extraction
36,612,972
3
false
0
0
SUTime runs on the JVM. So am not sure if you can call it from Python seamlessly. There's no SUTime port for Python as far as I know.
1
2
0
For date extraction I tried to use NLTK (part of Natural Language Processing) - regular expression,unigram. Using these I could extract date but when I pass different messages for the same date extractor, it is unable to identify the date format. When i further googled it I came across SUTime for extracting date. Can a...
How to use SUTime,NLP in python inorder to extract date
0
0
0
3,272
33,331,899
2015-10-25T16:13:00.000
0
0
1
0
python,function,namespaces
33,331,933
1
true
0
0
No! Python has namespaces, so you do not have to use prefixes. Prefixes are only useful for languages with out of namespaces like C or ObjC
1
0
0
I have a file in my Python project containing a number of functions that will modify various data objects within my app. I've called this file conditions.py. Every function within this file, I've prefixed with condition_ (e.g. condition_limits() will limit integers between a specified range, condition_in_list() test...
Should I use a unique prefix for all functions within a Python module?
1.2
0
0
161
33,345,609
2015-10-26T12:19:00.000
0
0
0
1
python,testing,virtual-machine,squish
33,345,750
1
false
0
0
You can install an ssh server on the Windows machine and then use the paramiko module to communicate with it or you can also use wmi command to remotely execute command on Windows system.
1
1
0
I'll get right into the point. The problem is: my localmachine is a Windows OS I launched a Windows Virtual Machine (through VirtualBox) that awaits some python commands on my localhost I have a python script that I execute and after the VM is started, I want the script to open inside the VM, a cmd.exe process after c...
Send a DOS command in a virtual machines cmd through python script
0
0
0
615
33,345,960
2015-10-26T12:30:00.000
0
0
0
0
heroku,python-requests
33,346,079
1
false
1
0
Have your host based firewall throttle those requests. Depending on your setup, you can also add Nginx in to the mix, which can throttle requests too.
1
0
0
I am experiencing a once per 60-90 minute spike in traffic that's causing my Heroku app to slow to a crawl for the duration of the spike - NewRelic is reporting response times of 20-50 seconds per request, with 99% of that down to the Heroku router queuing requests up. The request count goes from an average of around 5...
How to deal with excessive requests on heroku
0
0
1
46
33,346,591
2015-10-26T13:08:00.000
1
0
0
0
python,pandas,numpy,nan,difference
42,668,700
5
false
0
0
When we are dealing with normal dataframes then only difference will be an inclusion of NAN values, means count does not include NAN values while counting rows. But if we are using these functions with the groupby then, to get the correct results by count() we have to associate any numeric field with the groupby to get...
1
131
1
That is the difference between groupby("x").count and groupby("x").size in pandas ? Does size just exclude nil ?
What is the difference between size and count in pandas?
0.039979
0
0
60,325
33,349,515
2015-10-26T15:28:00.000
0
0
1
0
python
33,349,868
2
true
0
0
I would advise you to type "Python /?" in a command prompt and see which possibilities you have (e.g. python -v gives a verbose output on the import statements in your code). Like this you might find a way of having more information without needing to modify your source code. Obviously I don't know if the information y...
1
0
0
I am analyzing an existing Python code that runs into hundreds of line. Adding log per line to capture flow / understanding run time processing is painful - but then the current application logging is very poor by just using print data. Hence for support purpose these are not enough as its difficult to understand witho...
Application logs for support and analysis purpose
1.2
0
0
38
33,349,846
2015-10-26T15:41:00.000
1
0
0
0
python,django,django-forms
33,350,576
2
false
1
0
I don't think there is a premade solution for you. You'll have to do one of two things: When the form is submitted, examine the value of the field in question. If it is equal to the default value, then ignore the result of has_changed and save it. (Be aware that this could result in duplicate items being saved, dep...
1
1
0
When looking for this feature, one is flooded under answers pointing toward the Form initial member. Yet, by its design, this approach would not save anything to database if the user does not change at least one value in the form, because the has_changed method returns False when only initial values are submitted. Then...
How to set a default value for a Django Form Field, that would be saved even in the absence of user initiated changes?
0.099668
0
0
1,119
33,350,153
2015-10-26T15:55:00.000
0
0
1
0
python,pandas,pytables
52,785,994
2
false
0
0
You really have to close the open store manually. There is no other way. Why? PyTables uses a file registry to track open files. A destructor for this file registry is registered with Python's atexit module, which is called when the Python interpreter exits. If this destructor method is called, it will print out t...
1
4
1
Is there a way to prevent PyTables from printing out Closing remaining open files:path/to/store.h5...done? I want to get rid of it just because it is clogging up the terminal. I'm using pandas.HDFStore if that matters.
Preventing PyTables (in Pandas) from printing "Closing remaining open files..."
0
0
0
1,063
33,350,869
2015-10-26T16:30:00.000
0
0
0
1
python,google-app-engine
33,351,187
1
false
1
0
It might help to include the code in question, but try putting a \ before the +, that's what can escape things within quotes in python, so it might work here. E.g.: C\+
1
0
0
I'm using full text search and I'd like to search for items that have a property with value 'C+' is there a way I can escape the '+' Char so that this search would work?
Escape characters in Google AppEngine full text search
0
0
0
92
33,352,298
2015-10-26T17:48:00.000
3
0
1
0
python,multithreading
33,352,887
2
true
0
0
python is not very intelligent about switching between threads Python threads work a certain way :-) if I use a thread lock where only 1 thread can run at a time... will that lock actually make anything run slower Err, no because there is nothing else runnable, so nothing else could run slower. If all but 1 threads...
1
5
0
I watched an excellent presentation on the GIL, and how when running in the interpreter only 1 single thread can run at a time. It also seemed that python is not very intelligent about switching between threads. If i am threading some operation that only runs in the interpreter, and it is not particularly CPU heavy, a...
How does python handle thread locking / context switching?
1.2
0
0
6,723
33,352,574
2015-10-26T18:01:00.000
0
0
1
0
python,windows,tkinter,console,py2exe
33,352,759
1
false
0
1
import subprocess subprocess.Popen("application.exe", shell = True)
1
0
0
I have made a GUI for my application. All scripts are in Python (2.7) and the GUI is created with Tkinter. I work on Linux, but I needed this app to be executable on Windows. So I've used py2exe, to create an executable. After a while it is working almost perfectly, but I have the following problem: Somewhere in the ap...
How to stop console from poping up when command is called from python GUI?
0
0
0
893
33,353,130
2015-10-26T18:33:00.000
0
0
0
0
python,animation,expression,maya,curves
33,353,440
1
false
0
0
I used this seems to work. cmds.scaleKey("animCurve.x", valuePivot=0, valueScale=0.42 )
1
0
0
If I wanted to move it correctly. I would select the whole curve and type *=.42 in the graph editor second box and the whole curve will move up. How do I do this using python. Do I use expression?
How do you move an animation curve in maya python?
0
0
0
594
33,353,398
2015-10-26T18:50:00.000
0
0
0
1
python,design-patterns,command-line-interface,restful-architecture,n-tier-architecture
33,353,621
1
true
1
0
Since your app is not very complex, I see 2 layers here: ServerClient: it provides API for remote calls and hides any details. It knows how to access HTTP server, provide auth, deal with errors etc. It has methods like do_something_good() which anyone may call and do not care if it remote method or not. CommandLine: i...
1
0
0
I am going to write some HTTP (REST) client in Python. This will be a Command Line Interface tool with no gui. I won't use any business logic objects, no database, just using an API to communicate with the server (using Curl). Would you recommend me some architectual patterns for doing that, except for Model View Contr...
Architectual pattern for CLI tool
1.2
0
0
355
33,353,968
2015-10-26T19:25:00.000
0
0
0
1
python,azure
42,435,442
4
false
0
0
BlobService is function you are trying to call, but it is not defined anywhere. It should be defined when you call from azure.storage import *. It is probably not being called, due to a difference in package versions. Calling from azure.storage.blob import * should work, as it is now invoked correctly.
3
0
0
I've installed the azure SDK for Python (pip install azure). I've copied the Python code on the MS Azure Machine Learning Batch patch for the ML web-service into an Anaconda Notebook. I've replaced all the place holders in the script with actual values as noted in the scripts comments. When I run the script I get the e...
How do I fix the 'BlobService' is not defined' error
0
0
0
3,863
33,353,968
2015-10-26T19:25:00.000
0
0
0
1
python,azure
33,354,366
4
false
0
0
It's been a long time since I did any Python, but BlobStorage is in the azure.storage.blob namespace I believe. So I don't think your from azure.storage import * is pulling it in. If you've got a code sample in a book which shows otherwise it may just be out of date.
3
0
0
I've installed the azure SDK for Python (pip install azure). I've copied the Python code on the MS Azure Machine Learning Batch patch for the ML web-service into an Anaconda Notebook. I've replaced all the place holders in the script with actual values as noted in the scripts comments. When I run the script I get the e...
How do I fix the 'BlobService' is not defined' error
0
0
0
3,863
33,353,968
2015-10-26T19:25:00.000
1
0
0
1
python,azure
33,355,053
4
false
0
0
James, I figured it out. I just changed from azure.storage import * to azure.storage.blob import * and it seems to be working.
3
0
0
I've installed the azure SDK for Python (pip install azure). I've copied the Python code on the MS Azure Machine Learning Batch patch for the ML web-service into an Anaconda Notebook. I've replaced all the place holders in the script with actual values as noted in the scripts comments. When I run the script I get the e...
How do I fix the 'BlobService' is not defined' error
0.049958
0
0
3,863
33,354,977
2015-10-26T20:28:00.000
0
1
0
0
python
33,374,589
2
false
0
0
ser = serial.Serial(3) # open COM 4 print ser.name # check which sport was really used and 'ser' is the serial object Here is the python code to open specific serial port.
1
0
0
I am using Python v2.7 on Win 7 PC. I have my robot connected to computer and COM 4 pops out in device manager. My plan is to send API to robot through COM 4. Here is the question, how could python identify which serial port is for which device? So far, I can list all the available ports in python, but I need to specif...
Serial Port Identity in Python
0
0
1
64
33,355,400
2015-10-26T20:52:00.000
2
0
1
0
windows,python-3.x,qr-code,barcode,zbar
33,369,080
6
false
0
0
Forget wrestling with all of the wrappers. The easiest solution for me was to simply use import os os.system(r'D:\Winapps\Zbar\bin\zbarimg.exe -d d:\Winapps\Zbar\Examples \barcode.png') Worked instantly. Hope this helps anyone else struggling with that issue.
1
2
0
I am pretty new to programming, and have never used Zbar before. I am trying to write a simple script that will allow me to import Zbar and use it to decode a barcode image. I already have a script set up to decode text from images that uses Pytesseract and Tesseract OCR, but I need to be able to decode barcodes as wel...
How do I import Zbar into my Python 3.4 script?
0.066568
0
0
15,721
33,359,740
2015-10-27T03:59:00.000
4
0
0
0
python,random
37,483,626
7
false
0
0
random.randrange(0,2) this works!
1
207
1
I want a random number between 0 and 1, like 0.3452. I used random.randrange(0, 1) but it is always 0 for me. What should I do?
Random number between 0 and 1?
0.113791
0
0
517,528
33,368,621
2015-10-27T12:58:00.000
4
0
1
1
python,flask,tornado,python-asyncio
33,369,914
1
false
1
0
No. It is possible to run Flask on Tornado's WSGIContainer, but since Flask is limited by the WSGI interface it will be unable to take advantage of Tornado's asynchronous features. gunicorn or uwsgi is generally a much better choice than Tornado's WSGIContainer unless you have a specific need to run a Flask application...
1
3
0
We have a project use Flask+Gunicorn(sync). This works well for a long time, however, recently i came across to know that Asyncio(Python3.5) support async io in standard library. However, before Asyncio, there are both Twisted and Tornado async servers. So, i wander whether Flask can use the aysncio feature of Tornad...
Can Flask use the async feature of Tornado Server?
0.664037
0
0
1,151
33,370,301
2015-10-27T14:12:00.000
1
0
0
0
python,django-cms
33,373,378
1
true
1
0
They are stored in the database you configured for Django. By default you can inspect the pages in the administration interface at /admin/cms/page/. In the database the table for them is by default named cms_page.
1
1
0
I am creating the new page in Django CMS. I want to see where the HTML pages get stored? I tried to find out every where also in the site-package, but I was not able to find it. Can anyone tell me when I create a new page in Django CMS in GUI view, then where it get stored?
Where the new pages get stored after creation in django CMS?
1.2
0
0
408
33,376,218
2015-10-27T18:50:00.000
1
0
1
0
java,php,python
33,376,321
1
false
0
0
Nope ... the runtimes usually store these variables in completely separate variable tables, namespaces, add custom identifiers to the variable names, etc. if it was handling multiple users in a single runtime environment. In the case of a webserver, each person that visits a site (i.e., connection) is a typically a com...
1
2
0
I am very premature to programming.I don't even know whether the question itself is right.I will explain what i meant here plainly. User 1 Login to the website.So all the objects and others are run with respect to the program code written. Now user 2 login to the website at same time say,so again these codes are run p...
How does compilers differentiate same variable created from different instantiations
0.197375
0
0
33
33,378,422
2015-10-27T21:02:00.000
8
0
0
0
python,amazon-web-services,boto3,amazon-iam,amazon-cloudfront
57,297,264
4
false
1
0
Just add profile to session configuration before client call. boto3.session.Session(profile_name='YOUR_PROFILE_NAME').client('cloudwatch')
1
214
0
I am using the Boto 3 python library, and want to connect to AWS CloudFront. I need to specify the correct AWS Profile (AWS Credentials), but looking at the official documentation, I see no way to specify it. I am initializing the client using the code: client = boto3.client('cloudfront') However, this results in it us...
How to choose an AWS profile when using boto3 to connect to CloudFront
1
0
1
163,599
33,381,808
2015-10-28T02:16:00.000
0
0
1
0
python,printf
33,381,822
5
false
0
0
print has a \n embedded in it....so you don't need to add \n by yourself
2
0
0
I am reading files in a folder in a python. I want print the each file content separate by a single empty line. So, after the for loop I am adding print("\n") which adding two empty lines of each file content. How can I resolve this problem?
print only one single empty line
0
0
0
73
33,381,808
2015-10-28T02:16:00.000
1
0
1
0
python,printf
33,382,026
5
false
0
0
From help(print) (I think you're using Python 3): print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between v...
2
0
0
I am reading files in a folder in a python. I want print the each file content separate by a single empty line. So, after the for loop I am adding print("\n") which adding two empty lines of each file content. How can I resolve this problem?
print only one single empty line
0.039979
0
0
73
33,382,383
2015-10-28T03:24:00.000
3
0
1
0
python,file-writing
33,382,404
2
false
0
0
Option 3: Write the lines as you generate them. Writes are already buffered; you don't have to do it manually as in options 1 and 2.
2
1
0
I need to auto-generate a somewhat large Makefile using a Python script. The number of lines is expected to be relatively large. The routine for writing to the file is composed of nested loops, whole bunch of conditions etc. My options: Start with an empty string and keep appending the lines to it and finally write th...
Pythonic way to write a large number of lines to a file
0.291313
0
0
1,175