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
34,528,107
2015-12-30T10:56:00.000
1
0
1
1
python,macos,python-2.7,python-3.x
34,528,349
7
false
0
0
If you dont have any python 2 scripts that you use, you can delete python2. But its not a problem to have them both installed. You just have to use another path python3 to launch IDLE. I would prefer to let them both installled so if you have any scripts that are in python 2 you can still run them or you have to port ...
6
8
0
I have just installed Python 3.5.1 on my Mac (running the latest version of OSX). My system came with Python 2.7 installed. When I type IDLE at the Terminal prompt my system pulls up the original Python 2.7 rather than the newly installed Python 3.5. How do I get my system to default to Python 3.5.1 when I open the IDL...
How do I make Python 3.5 my default version on MacOS?
0.028564
0
0
36,713
34,528,107
2015-12-30T10:56:00.000
3
0
1
1
python,macos,python-2.7,python-3.x
34,528,211
7
false
0
0
You can use the python3 command (instead of using python), or you can simply uninstall the 2.7 version if you don't use it
6
8
0
I have just installed Python 3.5.1 on my Mac (running the latest version of OSX). My system came with Python 2.7 installed. When I type IDLE at the Terminal prompt my system pulls up the original Python 2.7 rather than the newly installed Python 3.5. How do I get my system to default to Python 3.5.1 when I open the IDL...
How do I make Python 3.5 my default version on MacOS?
0.085505
0
0
36,713
34,528,107
2015-12-30T10:56:00.000
0
0
1
1
python,macos,python-2.7,python-3.x
40,856,469
7
false
0
0
By typing python, you are actually referring to a link. You will find its location with $ which python. In my case it was /usr/local/bin/python. go there $open /usr/local/bin/ and just delete the original python, python-config and idle as they are identical to the 2.7 files in the same folder. Then duplicate the 3.5 fi...
6
8
0
I have just installed Python 3.5.1 on my Mac (running the latest version of OSX). My system came with Python 2.7 installed. When I type IDLE at the Terminal prompt my system pulls up the original Python 2.7 rather than the newly installed Python 3.5. How do I get my system to default to Python 3.5.1 when I open the IDL...
How do I make Python 3.5 my default version on MacOS?
0
0
0
36,713
34,528,609
2015-12-30T11:27:00.000
1
0
0
1
python,subprocess
34,528,893
2
false
0
0
Things you use from anywhere should be reachable from anywhere. That's where the system's PATH environment variable comes in. You should either move your script to a directory in the PATH, or extend the PATH with the location of your script. Note: make sure the script works location-independently: use sys.path extensiv...
1
4
0
I have this program Namechange.py which changes names from files (always cuts some useless end). Everything works fine, but I use this file a lot in a lot of different directories, which is bothersome when I want to change something. What I'm searching for is a python script which let's me execute this script in a dire...
Running Python Script from different working directory
0.099668
0
0
8,093
34,531,166
2015-12-30T14:10:00.000
0
0
1
0
python,python-2.7,python-3.x
34,532,346
3
false
0
0
Well, here is a much prose version of previous answers range(15) actually generates a list with indexes from 0 through 14 range(0, 15) does the same; except that both starting and ending indexes are specified list[:14] accesses contents of list including 14th index (15th element) list[1:] access contents of list from ...
1
0
0
I'm still beginner in python world and one of the things that made my head turns.. is the range built-in and the list indexes. How can I know if the range would or wouldn't take the last number? For example range(15) will it count to 15 or 14? range(1,15) will it count to 15 or 14? List_1 [ :15] will it count to 16 (...
Confused with Python range and list indexes
0
0
0
175
34,532,708
2015-12-30T15:52:00.000
0
0
0
0
python,excel,qlikview
34,534,891
3
false
0
1
I have had QlikView crash when importing an Excel spreadsheet that was exported with the SQuirreL SQL client (from a Firebird database). Opening the spreadsheet in Excel, and saving it again solved the problem. I know that this is no longer relevant to your problem, but hopefully it can help someone with a similarly ap...
1
0
0
I have data in an excel spreadsheet (*.xlsx) that consists of 1,213 rows of sensitive information (so, I'm sorry I can't share the data) and 35 columns. Every entry is a string (I don't know if that is screwing it up or not). The first row is the column names and I've never had a problem importing it with the column na...
Why does QlikView keep crashing when I try to load my data?
0
1
0
626
34,538,988
2015-12-30T23:43:00.000
1
0
0
0
android,python,apk,android-install-apk
62,234,030
2
true
0
1
As @Swing mentioned in his comment, subprocess.call("adb install path-to-file.apk ") solves the issue.
1
3
0
Is there a way to programmatically install an Android .apk in Python? Could you please show me how? I'm new to Python. Thanks in advance.
How to install an Android .APK using Python code?
1.2
0
0
2,635
34,540,405
2015-12-31T02:58:00.000
5
0
1
0
python,infinite,python-datamodel
34,540,424
4
true
0
0
__len__() must return a valid integer. Since you cannot, you should either not implement __len__(), if your sequences are always infinite, or raise a ValueError if you can sometimes give a meaningful length.
3
5
0
I am writing a python class that acts as an immutable, infinite sequence. The class does not use a generator to access this infinite sequence, rather it generates a value for an arbitrary index in the sequence according to an algorithm within the __getitem__ method. I am curious what the best way to handle the __len__ ...
Proper return value for __len__ for an object that acts as an infinite sequence
1.2
0
0
945
34,540,405
2015-12-31T02:58:00.000
3
0
1
0
python,infinite,python-datamodel
34,540,425
4
false
0
0
I think the only reasonable solution is to not implement __len__ at all, since in fact your object does not have a length.
3
5
0
I am writing a python class that acts as an immutable, infinite sequence. The class does not use a generator to access this infinite sequence, rather it generates a value for an arbitrary index in the sequence according to an algorithm within the __getitem__ method. I am curious what the best way to handle the __len__ ...
Proper return value for __len__ for an object that acts as an infinite sequence
0.148885
0
0
945
34,540,405
2015-12-31T02:58:00.000
3
0
1
0
python,infinite,python-datamodel
34,540,426
4
false
0
0
Don't define __len__ for this class because that's semantically impossible to answer for it.
3
5
0
I am writing a python class that acts as an immutable, infinite sequence. The class does not use a generator to access this infinite sequence, rather it generates a value for an arbitrary index in the sequence according to an algorithm within the __getitem__ method. I am curious what the best way to handle the __len__ ...
Proper return value for __len__ for an object that acts as an infinite sequence
0.148885
0
0
945
34,542,440
2015-12-31T06:54:00.000
0
0
0
0
javascript,java,php,python
34,542,478
1
false
0
0
For this task, you have to user registration/login functionality. Otherwise, you will get incorrect data. My suggested workflow: User registers on site with his email id. Confirmation mail goes to user. User clicks on confirm link and proves that he is genuine. After that he votes. His vote gets recorded against his e...
1
2
0
I'm developing a website to find out the best politician of my state.In my website visitors can vote for their favorite politician. I want to restrict the users adding more than one vote to a politician and also wants to restrict a user vote for more than one politician (A user can give one vote to any one politician)....
unique user identification for a website
0
0
1
96
34,543,516
2015-12-31T08:35:00.000
2
0
1
0
python,class,attributes
34,544,373
3
true
0
0
__getattribute__() method is for lower level attribute processing. Default implementation tries to find the name in the internal __dict__ (or __slots__). If the attribute is not found, it calls __getattr__(). UPDATE (as in the comment): They are different ways for finding attributes in the Python data model. They are ...
1
8
0
I understand that in python, whenever you access a class/instance variable, it will call __getattribute__ method to get the result. However I can also use obj.__dict__['x'] directly, and get what I want. I am a little confused about what is the difference? Also when I use getattr(obj, name), is it calling __getattribu...
Difference between __getattribute__ and obj.__dict__['x'] in python?
1.2
0
0
1,366
34,546,117
2015-12-31T11:50:00.000
3
0
0
0
python,amazon-s3,pydub
34,548,666
1
true
1
0
The delay is caused by the transcoding step (converting the raw data to mp3). You can avoid that by exporting WAV files. A WAV file is essentially just the raw data with some header information at the beginning so exporting with format="wav" will avoid the need to transcode, and should be significantly faster. However,...
1
2
0
I need to upload AudioSegment object to S3 after doing some editing. What I'm doing is to edit the audio, then export it and then send it to S3. However, export to mp3 is taking like 2 seconds for 2 minutes song. So, I'm just wondering if it's possible to send the file to S3 without export it. Note: I see there is raw_...
Python Pydub AudioSegment laggy export
1.2
0
1
674
34,547,795
2015-12-31T14:30:00.000
0
0
1
0
python,anaconda,macports,caffe
34,549,989
2
false
0
0
Install pyvenv ... it is easy to do on a Mac - then you can use whatever you want to.
2
0
0
I installed caffe using Macports sudo port install caffe. However, Macports didn't use my anaconda python, which I would like to use for development. I can only import caffe in Macports' python2.7. Is there a way to show anaconda python where to look or do I have to reinstall for anaconda python? Either way, I would be...
Macports caffe wrong python
0
0
0
132
34,547,795
2015-12-31T14:30:00.000
0
0
1
0
python,anaconda,macports,caffe
34,557,806
2
true
0
0
MacPorts never installs modules for use with other Python versions than MacPorts' own version. As a consequence, there is no switch to select the Python version to build against. You'll have to install caffe for your Anaconda Python yourself, e.g. in a virtualenv, or use MacPorts Python.
2
0
0
I installed caffe using Macports sudo port install caffe. However, Macports didn't use my anaconda python, which I would like to use for development. I can only import caffe in Macports' python2.7. Is there a way to show anaconda python where to look or do I have to reinstall for anaconda python? Either way, I would be...
Macports caffe wrong python
1.2
0
0
132
34,553,230
2016-01-01T03:06:00.000
0
0
1
0
python,macports
34,557,769
1
false
0
0
MacPorts packages multiple Python versions that can be installed side-by-side. See the python27 and python35 ports that provide Python 2.7 and 3.5, respectively. MacPorts itself does not have the notion of a "default python", its packages always explicitly depend on a specific version of Python. The port that fails to ...
1
0
0
I am installing a package on macports (ocaml) which is failing because one of the dependencies won't install with python 3.5 (which I have reported as a bug). The maintainer says it works with python2.7 Can I temporarily tell macports to use python2.7 for the install, instead of the more cumbersome approach of changi...
How to force a certain python version during a macports install
0
0
0
388
34,553,778
2016-01-01T05:26:00.000
2
0
0
0
python,sql,database,postgresql,caching
58,349,778
2
false
0
0
Tuning PostgreSQL is far more than just tuning caches. In fact, the primary high level things are "shared buffers" (think of this as the main data and index cache), and the work_mem. The shared buffers help with reading and writing. You want to give it a decent size, but it's for the entire cluster.. and you can't real...
1
11
0
My application is very database intensive so I'm trying to reduce the load on the database. I am using PostgreSQL as rdbms and python is the programming language. To reduce the load I am already using a caching mechanism in the application. The caching type I used is a server cache, browser cache. Currently I'm tuning ...
Enable the query cache in postgreSQL to improve performance
0.197375
1
0
3,440
34,554,247
2016-01-01T07:03:00.000
6
0
1
0
python-2.7,asynchronous,tornado,python-multithreading
34,560,074
1
true
0
0
"Asynchronous object" just means an object like IOStream or HTTPServer which has asynchronous methods. You should almost always use IOLoop.current() instead of IOLoop.instance(). In most cases they are equivalent because you only have one thread and one IOLoop, but when they are different current() is usually what you...
1
3
0
I have been looking through tornado documents. While reading on IOLoop, there are contents on which It is saying like below. In general you should use IOLoop.current as the default when constructing an asynchronous object, and use IOLoop.instance when you mean to communicate to the main thread from a different one...
Python Tornado I/O Loop current() vs instance() method
1.2
0
0
3,205
34,554,852
2016-01-01T09:03:00.000
0
0
1
1
python,macos,tags,finder
47,679,286
2
false
0
0
Late to the party here, but this is something that has been bugging me too — and I eventually came up with a run-round for tech-shy people that requires no line-command coding, just ordinary Finder commands and SimpleText. Try the following: open a Finder window containing the tagged files and Select All right-click o...
1
4
0
I'd like to tag some files on my Mac with Finder under a certain color tag, and then be able to get that list of files using a Python or bash script. Is it possible to get the list of tags associated with a file via the command line or a Python script?
How to get list of files on Mac that have been tagged by Finder with a color?
0
0
0
3,233
34,556,476
2016-01-01T13:19:00.000
10
0
0
0
python,machine-learning,scikit-learn
34,558,742
1
true
0
0
C and alpha both have the same effect. The difference is a choice of terminology. C is proportional to 1/alpha. You should use GridSearchCV to select either alpha or C the same way, but remember a higher C is more likely to overfit, where a lower alpha is more likely to overfit. L2 will produce a model with many small ...
1
3
1
Python scikit-learn SGDClassifier() supports both l1, l2, and elastic, it seems to be important to find optimal value of regularization parameter. I got an advice to use SGDClassifier() with GridSearchCV() to do this, but in SGDClassifier serves only regularization parameter alpha. If I use loss functions such as SVM o...
Regularization parameter and iteration of SGDClassifier in scikit-learn
1.2
0
0
4,643
34,568,325
2016-01-02T16:56:00.000
0
0
1
1
python,django,python-imaging-library,pillow
34,580,302
1
true
0
0
thanks to all at last solved my problem, I have install PIL in system sudo apt-get install python3-pil next I have copy this in my virtualenv cp -R /usr/lib/python3/dist-packages/PIL /home/netai/lab/django/rangoenv/lib/python3.4/site-packages/
1
0
0
I failed trying to install Pillow 3.0.0 on my Ubuntu 14.04 and python 3.4.3 from virtualenv. everytime I get error: pip install pillow Building using 2 processes i686-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -Qunuse...
django ubuntu error pillow 3.0.0 install error
1.2
0
0
242
34,570,992
2016-01-02T21:38:00.000
1
0
1
0
python,python-3.x,abstract-syntax-tree
34,571,022
4
true
0
0
You might create some hash table associating AST nodes to AST nodes and scan (recursively) your topmost AST tree to register in that hash table the parent of each node.
2
16
0
I'm working with Abstract Syntax Trees in Python 3. The ast library gives many ways to get children of the node (you can use iter_child_nodes() or walk()) but no ways to get parent of one. Also, every node has links to its children, but it hasn't links to its parent. How I can get the parent of AST node if I don't want...
Getting parent of AST node in Python
1.2
0
0
4,325
34,570,992
2016-01-02T21:38:00.000
0
0
1
0
python,python-3.x,abstract-syntax-tree
34,571,024
4
false
0
0
It wouldn't be really be a plugin, but you can always write a function which adds a weakref to parent in every child.
2
16
0
I'm working with Abstract Syntax Trees in Python 3. The ast library gives many ways to get children of the node (you can use iter_child_nodes() or walk()) but no ways to get parent of one. Also, every node has links to its children, but it hasn't links to its parent. How I can get the parent of AST node if I don't want...
Getting parent of AST node in Python
0
0
0
4,325
34,572,133
2016-01-03T00:21:00.000
0
0
1
0
python,matplotlib,dataframe
34,572,201
1
false
0
0
You can use the indexing notation: Iris['Petal.Length']. Using . (as in Iris.Species) only works if the column name is a valid Python identifier, but [] always works, even if the column name contains spaces or other symbols.
1
1
1
I could not find a particular way to phrase this into a google search that returned any solid results so asking StackOverflow. Would appreciate the help all! I am using a CSV file, Iris, in Python to do some basic matplot plotting. Within Iris, I am looking to reference a particular column called Petal.Length. Normally...
How do I quote a column in a dataframe that has a period?
0
0
0
79
34,574,396
2016-01-03T07:43:00.000
1
0
0
0
python,numpy
34,574,445
1
true
0
0
If you need to re-read it quickly into numpy you could just use the cPickle module. This is going to be much faster that parsing it back from an ASCII dump (but however only the program will be able to re-read it). As a bonus with just one instruction you could dump more than a single matrix (i.e. any data structure bu...
1
2
1
Here is my question: I have a 3-d numpy array Data which in the shape of (1000, 100, 100). And I want to save it as a .txt or .csv file, how to achieve that? My first attempt was to reshape it into a 1-d array which length 1000*100*100, and transfer it into pandas.Dataframe, and then, I save it as .csv file. When I...
How to save the n-d numpy array data and read it quickly next time?
1.2
0
0
53
34,576,501
2016-01-03T12:24:00.000
0
0
0
0
python,django,django-admin,django-suit
34,578,120
1
false
1
0
Nested inlines is something that isn't supported across the board, as it's not really part of the Django forms system (which is what the Django admin is based on). I'm sure this may change in the future, but for now the simplest thing you can do is just use multiple admins. It means saving in one form, then going into ...
1
1
0
I have installed django-suit for my admin. the main reason was django suit tabs.My model contains Students, each student can have multiple Projects and multiple Books, each book or project have multiple specific deadlines ( in the future ). so I need a nested-inline, I found plenty over pypi and tested some. I have som...
nested-inlines and django-suit
0
0
0
700
34,578,910
2016-01-03T16:37:00.000
0
0
0
0
python,openpyxl
34,579,357
3
false
0
0
This isn't currently directly possible. You could do it manually by creating a definedNamed using the reserved xlnm prefix (see Worksheet.add_print_title for an example.
1
2
0
I am trying to use OpenPyXL to create invoices. I have a worksheet with an area to be printed and some notes outside of that range. I have most everything working but I am unable to find anything in the API for one function. Is there a way to set the print area on a worksheet? I am able to find lots of print settings, ...
OpenPyXL - How to set print area for a worksheet
0
1
0
3,471
34,582,429
2016-01-03T22:35:00.000
4
0
1
0
python,paste
34,582,502
5
true
0
0
If you want to copy something from the python console: Highlight what you want to copy and right click on the top border of the python console>edit>copy If you want to paste into python console window: Make sure the coping mentioned above is the last action taken, and you will be able to simply right click I'm the pyth...
3
4
0
How can I paste something from the clipboard onto a Python window. I press Ctrl-V and it doesn't work. I click the right button of my mouse and nothing happens. Do I need to install something? I have Python 2.7.11 on Windows 7.
How do I paste from the clipboard into a Python window?
1.2
0
0
26,458
34,582,429
2016-01-03T22:35:00.000
0
0
1
0
python,paste
50,545,934
5
false
0
0
in the above at the left most portion there is present python symbol, go and right click to that python symbol, you will found "edit" option is there. click edit and you will gate PASTE.
3
4
0
How can I paste something from the clipboard onto a Python window. I press Ctrl-V and it doesn't work. I click the right button of my mouse and nothing happens. Do I need to install something? I have Python 2.7.11 on Windows 7.
How do I paste from the clipboard into a Python window?
0
0
0
26,458
34,582,429
2016-01-03T22:35:00.000
0
0
1
0
python,paste
72,500,164
5
false
0
0
try using magic commands %paste or %cpaste above the copied line of code. This will prevent any unexpected errors. Use % for line magic and %% for cell magic.
3
4
0
How can I paste something from the clipboard onto a Python window. I press Ctrl-V and it doesn't work. I click the right button of my mouse and nothing happens. Do I need to install something? I have Python 2.7.11 on Windows 7.
How do I paste from the clipboard into a Python window?
0
0
0
26,458
34,583,134
2016-01-04T00:10:00.000
0
1
1
0
python,c++,python-embedding
34,583,312
3
false
0
1
Are you sure that you need to embed the Python files? I ask because you mention you want to package the Python files as single executables. Couldn't you install Python on the target machine and since Python scripts are executables on their own, you would only need something to kick them off. A master python script cou...
1
1
0
If this question could be worded better/needs to be split into many questions, please alert me I need to package Python scripts in order to ship them as single-executables (ideally), or single-executables with supporting files (non-ideally). I have seen py2app and py2exe. They do not fit my requirements, as I am looki...
Embedding Python into C++
0
0
0
1,476
34,583,385
2016-01-04T00:51:00.000
4
0
0
1
python-2.7,google-app-engine,google-cloud-datastore
34,583,572
1
true
1
0
Create your "file" in memory (use e.g io.BytesIO) and then use the getvalue method of the in-memory "file" to get the blob of bytes for the datastore. Do note that a datastore entity is limited to a megabyte or so, thus it's quite possible that some SVG file might not fit in that space -- in which case, you should look...
1
3
0
i have a doubt, i need to create some svg files (in a sequence) and upload to data store. I know how to create the svg, but it save to filesystem, and i have understood that GAE cannot use it. So, i don't know how to create and put it on the datastore.
Create SVG and save it to datastore(GAE + Python)
1.2
0
0
260
34,583,421
2016-01-04T00:57:00.000
3
0
1
0
python,windows,python-3.5
34,583,849
1
true
0
0
I had a similar problem. You need to install visual studio 2015 (the community version is free). When you are going through the setup, at some point you will be able to choose optional features. There has been a change in the newer version, and the c++ compiler is now an optional feature, and your error message is ...
1
0
0
For two weeks now, I've been trying to install Python docx on Python 3.5 with Windows 7, and can't get beyond the "unable to find vcvarsall.bat" error. I have downloaded and installed Visual Studios 14.0, but so far I haven't been able to fix this. I have found a few answers here in Stack Overflow regarding this issue...
Python 3.5 "cannot find vcvarsall.bat"
1.2
0
0
1,466
34,586,419
2016-01-04T07:24:00.000
3
1
0
0
python,amazon-web-services,amazon-s3,aws-lambda
34,586,632
3
true
0
0
I would use another S3 bucket to first send the data and then use it from the Lambda function
3
1
0
I am planning to invoke AWS Lambda function by modifying objects on AWS S3 bucket. I also need to send a large amount of data to the AWS Lambda function. How can I send the data to it in an efficient way?
Send large data to AWS Lambda function
1.2
0
1
1,571
34,586,419
2016-01-04T07:24:00.000
1
1
0
0
python,amazon-web-services,amazon-s3,aws-lambda
34,967,438
3
false
0
0
Your Lambda function should just read from the database your large data resides in. Assuming your modified object on S3 contains - inside the object or as the object name - some type of foreign key to the data you need out of your database: A) If your Lambda has access to the database directly: then you can just mak...
3
1
0
I am planning to invoke AWS Lambda function by modifying objects on AWS S3 bucket. I also need to send a large amount of data to the AWS Lambda function. How can I send the data to it in an efficient way?
Send large data to AWS Lambda function
0.066568
0
1
1,571
34,586,419
2016-01-04T07:24:00.000
1
1
0
0
python,amazon-web-services,amazon-s3,aws-lambda
38,183,446
3
false
0
0
I recently did this by gzipping the data before invoking the lambda function. This is super easy to do with most programming languages. Depending on your database content this will be a better or worse solution. The content of my database had a lot of data repetition and zipped very nicely.
3
1
0
I am planning to invoke AWS Lambda function by modifying objects on AWS S3 bucket. I also need to send a large amount of data to the AWS Lambda function. How can I send the data to it in an efficient way?
Send large data to AWS Lambda function
0.066568
0
1
1,571
34,590,285
2016-01-04T11:37:00.000
2
0
0
0
python,amazon-web-services,amazon-ec2,boto,boto3
34,590,510
1
false
1
0
There isn't a straight way. More appropriately, I would say there are couple of things which aren't fully right in your assumptions. The EC2 instances aren't directly tied to the Reserved Instances. It is more of a non-technical - pure billing concept and end of the month, AWS counts the number of instance hours and ...
1
4
0
I am query AWS using boto ec2 in python. Firstly I find all reserved instances by get_all_reserved_instances then I am also able to find total count of each instance_type by instance_count. I am trying to calculate total number of reserved instances under tags. Eg. We have two tags group and name. Then I want to show t...
How to find total number of reserved instances under particular tag?
0.379949
0
1
986
34,592,010
2016-01-04T13:13:00.000
0
0
0
0
python,image,pdf,pdf-generation
34,592,133
1
true
0
0
I really cannot see how this is significantly slower. The local disks bandwidth should be much larger than the internet bandwidth. So the extra local save/load times should be extremely low overhead. If you really wan't to speed stuff up, check if the file already exists locally before downloading. unless of course if ...
1
0
0
Is there a python pdf generator that can use an image directly from a given url? Right now I'm using ReportLab and I have to download and save the image to a file and then using filename I can add it to the PDF. Which is significatly slower I imagine, in comparison to directly downloading the image, storing it in memor...
Python PDF generation - image from internet
1.2
0
0
124
34,592,869
2016-01-04T14:02:00.000
2
0
1
0
python,datetime
34,592,899
3
false
0
0
There is no 24:00:00 in practice. After 23:59:59 there is 0:00:00
1
5
0
I'm using datetime module. I was told that 24:00:00 is a ValueError cause the hour is range from 00 to 23. So what time is the end of the day in 24hr clock? ---------Edited---------- Up to now I prefer Gord's answer. Though Igor has a very practical one. My question is what's the very last time of datetime module. Sinc...
Python: the end of the day using 24hr clock for datetime module
0.132549
0
0
7,105
34,593,129
2016-01-04T14:15:00.000
0
0
1
0
pycharm,ipython-notebook
34,593,227
1
false
0
0
Simplest solution - print somewhere __doc__ or use LPM when clicking on method you want to check to go directly to the file, where method you need is declared. Then you should have docstring of it.
1
0
0
I am developing ipython notebook in pycharm. But I don't know how to check the python doc of the library I use in the notebook with IDE support (like mouse over the code and python api doc display automatically). Does anyone know that ? Thanks
how to see the python api doc in pycharm ipython notebook
0
0
0
58
34,594,184
2016-01-04T15:13:00.000
1
1
1
1
python,macos,terminal,sublimetext
34,594,257
1
true
0
0
Run python -vvv to dump out imports Python is doing when it starts up. If the slowdown is by a third party library this should give a hint. Check your ~/.bashrc script for duplicate entries (see comments below).
1
1
0
I have been learning a lot of python recently using sublime text on a mac, I installed python 3 and have mainly been using that but as a lot of documentation is in python 2.7 and it comes with the Mac I decided to start using 2.7 instead. I have quite a few libraries installed (for python 3 and for 2.7) When I load my ...
Sublime Text Python builds and opening a terminal takes very long time
1.2
0
0
380
34,595,671
2016-01-04T16:37:00.000
-1
0
1
0
python,python-2.7
34,596,027
3
true
0
0
No, Python doesn't support inline functions.
1
3
0
Is it possible to somehow inline a function in python? I have a very long function in python, which I want to split up for readability in several functions. So the parts gets called only from one point, the in program, but very often. This reduces performance since function calls are very expensive. Is there a method t...
Is it possible to somehow inline a function in python? ( for both performance + maintainability )
1.2
0
0
2,573
34,597,732
2016-01-04T18:45:00.000
0
0
0
0
python,numpy,curve-fitting,algebra
38,167,204
1
false
0
0
Numpy has functions for multi-variable polynomial evaluation in the polynomial package -- polyval2d, polyval3d -- the problem is getting the coefficients. For fitting, you need the polyvander2d, polyvander3d functions that create the design matrices for the least squares fit. The multi-variable polynomial coefficients ...
1
0
1
Given some coordinates in 3D (x-, y- and z-axes), what I would like to do is to get a polynomial (fifth order). I know how to do it in 2D (for example just in x- and y-direction) via numpy. So my question is: Is it possible to do it also with the third (z-) axes? Sorry if I missed a question somewhere. Thank you.
Create 3D- polynomial via numpy etc. from given coordinates
0
0
0
260
34,603,090
2016-01-05T02:03:00.000
0
0
0
0
python,excel
34,603,357
4
false
0
0
Thank you for you inputs. I have found the solution I was looking for by using Numpy. data = np.loadtxt('C:\Users[User_Name]\Desktop[fname].csv', delimiter=',') using that it took the data and created an array with the data that I needed. Now I am able to use the data like any other matrix or array.
1
1
0
I am writing a python code for beam sizing. I have an Excel workbook from AISC that has all the data of the shapes and other various information on the cross-sections. I would like to be able to reference data in particular cells in this Excel workbook in my python code. For example if the width of rectangle is 2in a...
Reference Excel in Python
0
1
0
2,722
34,604,073
2016-01-05T04:18:00.000
1
0
1
0
python,visual-studio,visual-studio-2015
34,604,144
2
false
0
0
This is under the MS build folder , and your environments related python folders from inside the project lib folder itself C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Python Tools
2
0
0
For Microsoft Windows 10 Visual Studio 2015, what is the location on the hard drive where the Python tools for visual studio installs? I assume it should be C:\Program Files (x86)\Microsoft Visual Studio 14.0\Python, however I see no folder named Python or Python tools or anything like that under Visual Studio's direct...
What is the location of the Python tools for Visual Studio?
0.099668
0
0
343
34,604,073
2016-01-05T04:18:00.000
1
0
1
0
python,visual-studio,visual-studio-2015
34,604,122
2
true
0
0
See the MSBuild folder instead C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Python Tools
2
0
0
For Microsoft Windows 10 Visual Studio 2015, what is the location on the hard drive where the Python tools for visual studio installs? I assume it should be C:\Program Files (x86)\Microsoft Visual Studio 14.0\Python, however I see no folder named Python or Python tools or anything like that under Visual Studio's direct...
What is the location of the Python tools for Visual Studio?
1.2
0
0
343
34,606,134
2016-01-05T07:17:00.000
0
0
0
0
python,django
34,608,314
2
true
1
0
The reason some people put static files in /var/www is simply that that's where the default Apache configuration puts the DocumentRoot on Debian-based systems. But I wouldn't recommend doing that; much better to add an alias pointing at the STATICFILES dir inside your project itself. As for permissions, your suggestion...
2
1
0
I'm ready to deploy my completely revamped Django website, and I'm trying to figure out the best folder structure to use. When I had it deployed last time I did it all wrong, even though it was functional, so this time I'm trying to do it the "right" way. Unfortunately, it seems sometimes like there are too many "rig...
Django project structure in production
1.2
0
0
578
34,606,134
2016-01-05T07:17:00.000
0
0
0
0
python,django
34,608,455
2
false
1
0
Django is not PHP or ColdFusion, where you should keep project files inside /var/www in root. Read chapter from Two Scoops of Django: Best Practices for Django 1.8 about project structure - you should have customized settings for each environment. Also very good and reasonable idea is to have the same SQL engine on ev...
2
1
0
I'm ready to deploy my completely revamped Django website, and I'm trying to figure out the best folder structure to use. When I had it deployed last time I did it all wrong, even though it was functional, so this time I'm trying to do it the "right" way. Unfortunately, it seems sometimes like there are too many "rig...
Django project structure in production
0
0
0
578
34,609,259
2016-01-05T10:20:00.000
1
0
0
0
python,mysql,sql-server,database
34,609,510
1
true
0
0
Although I would consider creating and maintaining databases in Python bad practice ( at least for MySQL and SQL Server), these databases will be fully compatible with non-Python tools and processes as they are created with the same SQL code. Regarding SQLAlchemy, this is used by several major companies and I have neve...
1
0
0
I've had a fairly good look on the web for an answer to this question, but I've tended to find that people assume more knowledge of databases than I currently have. I'm sorry if this is a rookie question - I've always been aware of databases and their advantages, but never actually had to work with them. I have a requ...
Python linkage to SQL databases
1.2
1
0
93
34,610,986
2016-01-05T11:46:00.000
1
0
1
0
python,linux,python-import
34,611,128
2
false
0
0
You can try to use pyinstaller and provide a ready to use package (e.g. exe file on Windows) to your customers. So even if the other computer has no internet access to download missing packages, your script will work.
1
1
0
I wonder, if the required python library to be imported is not yet installed , and you need to import it , is there any way that can auto-install it if the library doesn't exists. My python scripts often include custom libraries that are not installed by default , and those scripts land on different machines with pyth...
Python Import error , auto install
0.099668
0
0
146
34,611,880
2016-01-05T12:36:00.000
2
0
0
0
python,python-2.7,scrapy
34,612,388
2
false
1
0
Different website - > different script in same project if scraping same data so in a same project both the scripts can reside and use the same pipeline Same website - > Same project Different website ,Different Data - > Different project Same website, different data - > Use 2 functions using callback
2
0
0
If we have multiple site which have different html structure so what is the better way to implement scrapy? should I create multiple spider according to site in single project? should I create multiple projects according to site? or another way, please define.
what is the better way to implement scrapy if we have multiple sites?
0.197375
0
1
297
34,611,880
2016-01-05T12:36:00.000
1
0
0
0
python,python-2.7,scrapy
34,612,562
2
true
1
0
Usually you should create multiple spiders in one project, one for each website, but this depends. A scrapy spider also decides how to jump from page to page, than it applies a parser callback, the parser callback method will extract the data from a page. Because pages are not the same you need a parser callback method...
2
0
0
If we have multiple site which have different html structure so what is the better way to implement scrapy? should I create multiple spider according to site in single project? should I create multiple projects according to site? or another way, please define.
what is the better way to implement scrapy if we have multiple sites?
1.2
0
1
297
34,613,875
2016-01-05T14:20:00.000
1
0
0
0
python,sql,pyodbc
47,834,345
2
false
0
0
You can't, only the last query row count is returned from executemany, at least that's how it says in the pyodbc code docs. -1 usually indicates problems with query though. If you absolutely need the rowcount, you need to either cursor.execute in a loop or write a patch for pyodbc library.
1
5
0
In pyodbc, cursor.rowcount works perfectly when using cursor.execute(). However, it always returns -1 when using cursor.executemany(). How does one get the correct row count for cursor.executemany()? This applies to multiple inserts, updates, and deletes.
How to get correct row count when using pyodbc cursor.executemany()
0.099668
1
0
7,653
34,613,958
2016-01-05T14:24:00.000
0
0
1
0
python,django,export-to-csv
34,614,120
1
false
0
0
CSV is not formatted. If you want to format the text in the cells, you should consider writing a proper Excel or PDF file. Anyway it looks like that newline characters (\n or \r\n) can be used in CSV files if using semicolon as separator, so this may not be portable. To write an Excel file, you can use libraries like o...
1
2
1
I am trying to export a file as csv. I need to wrap text for a particular column while writing in csv file. I have a too long string. i need to write it in a csv file using python. While trying to write, it doesn't write in a single cell. some of the lines are written into next rows. I need to write the whole string in...
How to wrap text with in a column while writing in csv file using python
0
0
0
4,140
34,615,600
2016-01-05T15:42:00.000
0
0
0
0
python,django,migration
43,460,655
1
false
1
0
This is a known issue with Django 1.8 unfortunately the only solution supported by django is to upgrade.
1
7
0
Ever since the project updated to Django 1.8 (1.8.7 to be precise) from Django 1.7.6, makemigrations and migrate are super slow (it takes about 15 minutes to migrate around 10 migrations). When I make 'manage.py migrate' 90% of the time is making 'Rendering model states...', before giving me 'DONE'. Anyone knows why t...
Django Makemigrations and Migrate are slow
0
0
0
1,805
34,616,218
2016-01-05T16:13:00.000
0
0
0
0
python,optimization,vehicle-routing
53,242,332
3
false
0
0
read some research papers on vehicle routing problem. i've seen some of the papers provides a complete algorithm on vehicle routing, and they come in different ways by considering multiple criteria. hence, it's possible to implement one or more of the algorithms provided in these papers and do a test to use the optimal...
1
0
0
I am working on a use case, in which I have multiple vehicles as depot,delivery boys and set of customers from diverse location to serve fresh food. Customers would place an order from an application,then delivery boy receives the order and get the food from Van and then deliver it with some promised delivery time(15 m...
Vehicle routing with time window Implementation in Python
0
0
0
4,855
34,621,426
2016-01-05T21:20:00.000
0
0
1
0
python,user-interface,wxpython
34,621,808
1
true
0
1
SetEventObject is used to set the originating GUI element not to pass data to the event listeners ... you could certainly add a GetValue method to your GUI element that returned your dictionary... and then use GetEventObject().GetValue() to get your dictionary alternatively the wx.lib.pubsub module is designed to pass...
1
0
0
I would like to set a dictionary as an event object, but SetEventItem is expecting an object of type wxObject. What's the best way to go around this? Basically, I have a settings dialog. If the "Apply All" button is pressed, an event is generated which will propagate up to some parent window, which can then set the se...
wxPython - Set dictionary as event object
1.2
0
0
90
34,624,978
2016-01-06T03:09:00.000
3
0
0
0
python,scikit-learn,random-forest,grid-search
59,507,979
4
false
0
0
Although the question has been solved years ago, I just found a more natural way if you insist on using GridSearchCV() instead of other means (ParameterGrid(), etc.): Create a sklearn.model_selection.PredefinedSplit(). It takes a parameter called test_fold, which is a list and has the same size as your input data. In...
1
30
1
There is absolutely helpful class GridSearchCV in scikit-learn to do grid search and cross validation, but I don't want to do cross validataion. I want to do grid search without cross validation and use whole data to train. To be more specific, I need to evaluate my model made by RandomForestClassifier with "oob score"...
Is there easy way to grid search without cross validation in python?
0.148885
0
0
20,780
34,625,218
2016-01-06T03:37:00.000
0
0
0
0
wxpython
34,937,077
1
true
0
1
I abandoned this approach as unwieldy after some effort, but I did have some limited success, and I wanted to point out some of the things I learned in case someone else is considering it. Look at PyPanel - it is designed to be overridden fairly extensively and responded well to most of what I was doing. The best appr...
1
0
0
I have a class derived from wx.Panel that creates an image in a large border area (e.g. a little over 30 pixels across on the left edge). I want to be able to derive subclasses from it for the panels in part of my application, but I can't figure out how to adjust the position the children in the derived panels - they ...
How to reposition children in wx.Panel derived class with a large border?
1.2
0
0
119
34,625,232
2016-01-06T03:38:00.000
3
0
0
0
python,google-chrome-extension
34,625,489
1
false
0
0
A google chrome extension is simply a webpage with a few extra permissions and so on. So, what you're looking for is basically a method to use python as a scripting language inside a browser. The problems with this : Not all browsers are capable of using python as a scripting language By default javascript scripts are...
1
4
0
I have read some introduction about how to create Google Chrome extensions. Is that possible to create the extension using Python instead of JS?
Can I use python to develop Google Chrome extensions?
0.53705
0
1
3,959
34,626,477
2016-01-06T05:49:00.000
0
1
1
0
python,libvlc
47,785,613
3
false
0
0
Try to use pip install python-vlc in command prompt (if you are using windows). This will remove that error, as vlc is not yet installed on your system. If you are using Ubuntu or other Linux Kernel OS, then first install pip (and python) on your system using whatever your package manager is (if necessary), then do pip...
2
2
0
I want to import the vlc from my python script, but it is getting error like follows: Traceback (most recent call last): File "test.py", line 3, in import vlc ImportError: No module named vlc How to solve this problem??
vlc import error in python script + ubuntu 14.04LTS
0
0
0
1,605
34,626,477
2016-01-06T05:49:00.000
1
1
1
0
python,libvlc
63,069,430
3
false
0
0
For people stumbling upon this answer in 2020 and using Debian Linux, try the following command: sudo pip3 install python-vlc
2
2
0
I want to import the vlc from my python script, but it is getting error like follows: Traceback (most recent call last): File "test.py", line 3, in import vlc ImportError: No module named vlc How to solve this problem??
vlc import error in python script + ubuntu 14.04LTS
0.066568
0
0
1,605
34,629,190
2016-01-06T09:04:00.000
1
0
0
0
python,html,kivy,qspinbox
34,631,685
1
false
1
1
You can use a Spinner widget._
1
0
0
I am making an app with Kivy and Python,is there a native way to create a field with a spinbox to select the number like in HTML for the tag input (type = "number") ?? I see there are checkboxes for Kivy but not this spinbox number; should I use a normal text input provided by Kivy and get the number from that?
Kivy native spinbox number widget for insert number
0.197375
0
0
547
34,629,706
2016-01-06T09:33:00.000
0
0
0
0
python,xmpp,xmpppy
39,726,299
1
false
0
0
I don't think step 3 can quite be done with plain XMPP, but, if your XMPP server is your own, and it supports plugins, one possible workaround would be to write a plugin that "fakes" this interaction by making answers@example.com pretend to be User1@example.com from the point of view of the other users when making the ...
1
1
0
I am working on a requirement in which user will ask query and that query will be routed to group of users. Group of users can directly communicate with seeker. All using XMPP python client and XMPP server(ejabberd) Detailed scenario: User1@example.com asks a query and it is destined to answers@example.com answers@ex...
Using XMPP developing a client which acts a mediator in two users
0
0
1
80
34,629,913
2016-01-06T09:43:00.000
3
0
1
0
ipython,spyder
34,643,480
2
false
0
0
(Spyder dev here) There is no way to start an IPython console inside Spyder with a different profile. We use the default profile to create all our consoles.
2
1
0
I use two installations of Spyder, one using my default python 2.7 and the other running in a python 3.4 virtualenv. However, the history of the IPython console is shared between the two. The cleanest way to have separate histories would be to define a new IPython profile for the python 3.4 installation. My question is...
Non-default IPython profile in Spyder console
0.291313
0
0
397
34,629,913
2016-01-06T09:43:00.000
0
0
1
0
ipython,spyder
34,657,322
2
true
0
0
As mentioned by Carlos' answer, there is no way to start an IPython console inside Spyder with a different profile. A workaround is to duplicate the ~/.ipython directory (I named mine ~/.ipython3) and set the environment variable IPYTHONDIR to the new location before running the python 3 version of Spyder. It will then...
2
1
0
I use two installations of Spyder, one using my default python 2.7 and the other running in a python 3.4 virtualenv. However, the history of the IPython console is shared between the two. The cleanest way to have separate histories would be to define a new IPython profile for the python 3.4 installation. My question is...
Non-default IPython profile in Spyder console
1.2
0
0
397
34,633,178
2016-01-06T12:28:00.000
27
0
1
0
python,algorithm,list,big-o
34,633,242
2
true
0
0
Python's list implementation uses a dynamically resized C array under the hood, removing elements usually requires you to move elements following after up to prevent gaps. list.pop() with no arguments removes the last element. Accessing that element can be done in constant time. There are no elements following so nothi...
1
10
0
Shouldn't they both be O(1), as popping an element from any location in a Python list involves destroying that list and creating one at a new memory location?
Why is the big O of pop() different from pop(0) in python
1.2
0
0
12,840
34,634,735
2016-01-06T13:49:00.000
0
0
0
0
python-2.7,validation,wxpython
34,651,896
1
true
0
1
Bind the textctrl to wx.EVT_KILL_FOCUS and then check the contents of the textctrl. If there is invalid input, issue your error message and then self.my_textCtrl.SetFocus() which will put you back in the textctrl for input again.
1
0
0
I have a number of wxPython textCtrls that are used for data input. Use is made of various Validators to make sure the data is of the correct type. I now need to validate that the data is within range, e.g. where two textCtrls are used for feet and inches that the inches are less than 12, before the user can move to th...
Validating wx.textCtrl Field For Sensible Values
1.2
0
0
165
34,635,864
2016-01-06T14:43:00.000
1
0
1
0
python,windows,numpy,pip,importerror
34,635,986
1
false
0
0
Try the command python -m pip install numpy (without the version number).
1
0
0
I have just installed python 3.5.1 and i read that pip should be installed by default. I am trying to install the package: numpy 1.10.2 by using the command: python -m pip install numpy 1.10.2 just as it says in the python documentation, but i get the error: ImportError: No module named site. I am on windows and writi...
Python error installing package
0.197375
0
0
3,144
34,640,980
2016-01-06T19:15:00.000
1
0
1
0
python,arguments
34,641,159
1
false
0
0
The standard error message seems quite adequate, in my opinion. What more would you want to tell the user? But to answer the question, you could have your method take a variable number of arguments (i.e. *args or **kwargs) and then count the number of arguments within the method and raise your own error if necessary. ...
1
0
0
When a user calls a method and does not provide the proper number of arguments, I would like to be able to tell them which arguments they are missing. However, my understanding is that the method that is causing the error is not actually being called, so then I can't write code within the method itself that would raise...
How to raise more helpful error message than "takes exactly x arguments ( y given)"
0.197375
0
0
41
34,642,371
2016-01-06T20:42:00.000
0
0
1
0
python,python-2.7,oop,inheritance
34,642,567
2
false
0
0
Maybe I didn't understand you correctly, but I would do the following: re-write the __init__ method in MicroSDCard class with the new attribute. for any method that utilize this new attribute, you need to re-write (overload) it in the MicroSDCard class definition. That looks too simple, so I guess I didn't get your q...
1
0
0
example: I have a class that is called "MicroSDCard" this class inherits from a class that is called "MemoryCard", but there is one change between them. MicroSDCard can get another value that is called Frequency, and should retrurn it using the init method like this "self.max_freq". How can I make it happen? Thank you ...
How can I make a class that inherits methods from another class in python but also change only some part of a certain method?
0
0
0
53
34,649,314
2016-01-07T07:13:00.000
0
1
1
1
python,linux,centos6,hyper-v,wmic
35,030,932
1
false
0
0
There are so many scripts in C# to do the same work if you dont want to use powershell scripts you can choose the best method to run a powershell command for each thing and run the powershell command from python script i did the same in C# with Process Class
1
0
0
I am new to Hyper-v,WMI and using WMIC i need to create a VM(virtual machine). Can anybody help me through a sample code or script to refer? Preferred script language is Python and I am using CentOS 6 to run wmic. And is there any way to create VM via wmic commands? I have gone through many scripts and code snippets bu...
How to create virtual machine using WMIC on hyper-v with python script or any command?
0
0
0
605
34,649,751
2016-01-07T07:41:00.000
3
0
0
0
python,machine-learning,scikit-learn
34,653,721
2
false
0
0
From the Sci-Kit Documentation apply(X) Apply trees in the ensemble to X, return leaf indices This function will take input data X and each data point (x) in it will be applied to each non-linear classifier tree. After application, data point x will have associated with it the leaf it end up at for each decision tre...
1
0
1
In scikit-learn new version ,there is a new function called apply() in Gradient boosting. I'm really confused about it . Does it like the method:GBDT + LR that facebook has used? If dose, how can we make it work like GBDT + LR?
What the function apply() in scikit-learn can do?
0.291313
0
0
1,064
34,651,927
2016-01-07T09:46:00.000
1
0
1
1
python,subprocess,supervisord
34,670,535
2
true
0
0
You don't need to do anything. B inherits A's standard streams by default. If A's stdout is redirected to a file then B's stdout automatically writes to the same place.
1
0
0
My system is composed of a python application that is launched from supervisord. Let's call it A. A launches a subprocess B to do some of its task. Both A and B are coded in Python and use the standard logging module to output messages to the console. The stdout and stderr of A are logged to a file specified in the sup...
Logging from the children of a supervisord subprocess
1.2
0
0
353
34,655,628
2016-01-07T12:51:00.000
3
0
0
0
python,scikit-learn,random-forest,supervised-learning
34,661,470
1
true
0
0
Class weights are what you should be using. Sample weights allow you to specify a multiplier for the impact a particular sample has. Weighting a sample with a weight of 2.0 roughly has the same effect as if the point was present twice in the data (although the exact effect is estimator dependent). Class weights have th...
1
5
1
I am trying to solve a binary classification problem with a class imbalance. I have a dataset of 210,000 records in which 92 % are 0s and 8% are 1s. I am using sklearn (v 0.16) in python for random forests . I see there are two parameters sample_weight and class_weight while constructing the classifier. I am currentl...
How to handle class imbalance in sklearn random forests. Should I use sample weights or class weight parameter
1.2
0
0
3,318
34,657,738
2016-01-07T14:33:00.000
3
0
0
0
python-2.7,sorting,elasticsearch,scroll,pagination
60,524,939
2
false
1
0
When using the elasticsearch.helpers.scan function, you need to pass preserve_order=True to enable sorting. (Tested using elasticsearch==7.5.1)
1
1
0
I have a ES DB storing history records from a process I run every day. Because I want to show only 20 records per page in the history (order by date), I was using pagination (size + from_) combined scroll, which worked just fine. But when I wanted to used sort in the query it didn't work. So I found that scroll with so...
How can I use scan/scroll with pagination and sort in ElasticSearch?
0.291313
0
0
3,478
34,658,717
2016-01-07T15:16:00.000
0
0
1
0
python,c,cython
34,658,826
2
false
0
0
In C (proper C rather than C++) the variables have to be declared at the beginning of a block.
2
0
0
I am making some functions in c which I am going to call from Python via Cython. I am developing these functions in Code:Block using MinGW C++ compiler. But when building them for Python I have to use Visual Microsoft Visual C++ Compiler for Python 2. Then I have met a strang problem. When compiling with Visual C++ com...
Visual Microsoft Visual C++ Compiler for Python 2.7 vs MinGW
0
0
0
263
34,658,717
2016-01-07T15:16:00.000
1
0
1
0
python,c,cython
34,658,891
2
true
0
0
MSVC mostly adheres to the original C89 spec. In later revisions of the language this restriction has been lifted.
2
0
0
I am making some functions in c which I am going to call from Python via Cython. I am developing these functions in Code:Block using MinGW C++ compiler. But when building them for Python I have to use Visual Microsoft Visual C++ Compiler for Python 2. Then I have met a strang problem. When compiling with Visual C++ com...
Visual Microsoft Visual C++ Compiler for Python 2.7 vs MinGW
1.2
0
0
263
34,661,669
2016-01-07T17:38:00.000
2
1
1
0
python,pycharm,perforce,pyscripter
34,661,837
1
false
0
0
Go to File --> Open in Pycharm and select your Scripts(folder) and open it. Then the Pycharm will treat it as a project and you will be able to ctrl + click a function.
1
1
0
Ok, so I'm looking to switch to PyCharm from PyScripter for OS independent development. I also wanted to mention that I'm using Perforce for version control. So what I currently do is double click a .py for editing in Perforce, and PyScripter opens up and I edit to my hearts desire. I can click on an imported function...
Directory issues within Pycharm (free version) & Perforce
0.379949
0
0
207
34,662,353
2016-01-07T18:19:00.000
5
0
0
1
python,python-idle
34,662,742
1
false
0
0
If the recent-files.lst file is hidden, Python will fail to access it properly. You most likely tried to hide the .idlerc folder and applied the same settings to any subfolders. You can still keep that folder hidden, because it's ugly, but make sure not to set the recent-files.lst file to hidden, too.
1
1
0
I have no idea why this happens and then it doesn't come up with any typing cursor even when I click so I can't edit anything. I'm running Windows 10, and Python 3.4.4. Anyone know why this is happening? Cannon update File menu Recent Files list. Your operating system says: [Errno 13] Permission denied: 'C:\Users\Aaro...
"Cannot update File menu Recent Files list [Errno 13] Permission denied: recent-files.lst" when I open IDLE (Python 3.4 GUI)
0.761594
0
0
5,487
34,665,024
2016-01-07T20:57:00.000
0
0
1
0
python,python-3.x,input,menu,text-based
38,925,359
2
false
0
0
Use the plot functions to plot menu's. You can import menus that are already made and then modify them so they suit what you want. Ploted windows's can interact with your mouse and and keyboard to move through the menu and select a locations in it. You can make it look like a text menu, with the only diference it is in...
1
2
0
I have to make a program with a text based menu system for a school project. It includes a main menu and multiple sub-menus. I have made my current version of the menu with LOTS of if-statements, prints and inputs. But it is neither a elegant nor easy solution. I was hoping there was a easier / better way to create a m...
Simpler text menu in Python 3
0
0
0
1,122
34,668,127
2016-01-08T01:32:00.000
0
0
1
0
python,list,tuples
34,668,822
1
true
0
0
The syntax is arr[start:stop:step]. x[2::-1] would start from index 2 until the end of the array, so [x[2], x[1], x[0]], which is not what you want. If the step is negative, then the start defaults to -1. In python, arr[-1] would be the last element of the array, arr[-2] would be the second last etc. So x[:1:-1] == x[:...
1
1
0
If I have x = (0, 1, 2, 3, 4), and I want to get all the elements other the first two, but in reverse order, why is it supposed to be x[:1:-1] or x[:-4:-1] rather than x[2::-1]?
The reverse of a subset of a tuple or list
1.2
0
0
394
34,668,997
2016-01-08T03:24:00.000
0
0
1
0
python,virtualenv
34,669,093
1
false
0
0
Your default environment variables may be wrong in path, since the default path must point to the python globally. Try this: Start menu > Run > 'sysdm.cpl' > Enter Search for the tab 'Advanced' Finally 'Environment Variables' Edit the system variable 'Path' Carefully and search for the python path, just change it to ...
1
0
0
I have activated a python virtualenv (dev) for one of my projects. However, don't know what happened, it looks like it has changed the path permanently. I cannot access my global packages. When I print sys.path it shows me paths related to virtualenv (dev) which is no more activated. When I run pip list, it shows me pa...
Python virtualenv has changed sys.path permanently
0
0
0
156
34,671,202
2016-01-08T06:59:00.000
0
0
0
0
python,spotfire
37,417,767
1
false
0
0
You can apply custom sorting to STRING columns. One way to achieve your goal is to create calculated columns for the Year and Month, and use these in your date axis. Then you can apply a custom sorting in Column Properties > Sort Order on your data table.
1
0
1
In Spotfire text area, for drop down property, by default sort order for date column is coming with the oldest to latest. We need to display the dates order from newest to oldest. Can you please advise. Default Order:12/29/2015 12/30/2015 12/31/2015 01/01/2016 Needed 1/1/2016 12/31/2015 12/30/2015 12/29/2015 T...
How to change the sorting order of dates in the drop down property of spotfire
0
0
0
975
34,673,515
2016-01-08T09:28:00.000
0
0
0
0
python,django,forms,performance,amazon-s3
34,673,727
2
false
1
0
The usual solution to tasks that are too long to be handled synchronously and can be handled asynchronously is to delegate them to some async queue like celery. In your case, saving the form's data to db should be quite fast so I would not bother with this part, but moving the uploaded file to s3 and sending mails are...
1
1
0
I am writing a form submit in my application written in python/Django.Form has an attachment(upto 3MB) uploaded. On submit it has to save the attachment in aws s3, save the other data in database and also send emails. This form submit is taking too much time and the UI is hanging. Is there any other way to do this in p...
Python - On form submit send email and save record in database taking huge time
0
1
0
427
34,678,158
2016-01-08T13:23:00.000
1
0
1
0
python,list,sequence
34,678,249
3
false
0
0
The rules of arithmetic(operators in programming) still apply, you can't multiple with '0' or empty value and get something different, you get the original value that you had before.
1
3
0
I am new to python. i am learning some basic stuff. I was doing some operation on python list like this three_lists=[]*3 when i execute this piece of code it gives me only one empty list like this[]. Why it is not giving me 3 empty list? some what like this [],[],[]
Understanding Python List operation
0.066568
0
0
103
34,680,228
2016-01-08T15:13:00.000
1
0
1
1
python,macos,python-2.7,python-3.x,terminal
49,465,309
7
false
0
0
I just follow up the answer from @John Wilkey. My alias python used to represent python2.7 (located in /usr/bin). However the default python_path is now preceded by /usr/local/bin for python3; hence when typing python, I didn't get either the python version. I tried make a link in /usr/local/bin for python2: ln -s /usr...
4
57
0
I generally use Python 2.7 but recently installed Python 3.5 using Miniconda on Mac OS X. Different libraries have been installed for these two versions of python. Now, the entering either of the keywords 'python' or 'python3' in terminal invokes python 3.5, and 'python2' returns '-bash: python2: command not found'. Ho...
Switch between python 2.7 and python 3.5 on Mac OS X
0.028564
0
0
157,702
34,680,228
2016-01-08T15:13:00.000
5
0
1
1
python,macos,python-2.7,python-3.x,terminal
51,038,951
7
false
0
0
I already had python3 installed(via miniconda3) and needed to install python2 alongside in that case brew install python won't install python2, so you would need brew install python@2 . Now alias python2 refers to python2.x from /usr/bin/python and alias python3 refers to python3.x from /Users/ishandutta2007/miniconda3...
4
57
0
I generally use Python 2.7 but recently installed Python 3.5 using Miniconda on Mac OS X. Different libraries have been installed for these two versions of python. Now, the entering either of the keywords 'python' or 'python3' in terminal invokes python 3.5, and 'python2' returns '-bash: python2: command not found'. Ho...
Switch between python 2.7 and python 3.5 on Mac OS X
0.141893
0
0
157,702
34,680,228
2016-01-08T15:13:00.000
2
0
1
1
python,macos,python-2.7,python-3.x,terminal
52,135,099
7
false
0
0
Similar to John Wilkey's answer I would run python2 by finding which python, something like using /usr/bin/python and then creating an alias in .bash_profile: alias python2="/usr/bin/python" I can now run python3 by calling python and python2 by calling python2.
4
57
0
I generally use Python 2.7 but recently installed Python 3.5 using Miniconda on Mac OS X. Different libraries have been installed for these two versions of python. Now, the entering either of the keywords 'python' or 'python3' in terminal invokes python 3.5, and 'python2' returns '-bash: python2: command not found'. Ho...
Switch between python 2.7 and python 3.5 on Mac OS X
0.057081
0
0
157,702
34,680,228
2016-01-08T15:13:00.000
14
0
1
1
python,macos,python-2.7,python-3.x,terminal
34,686,323
7
false
0
0
OSX's Python binary (version 2) is located at /usr/bin/python if you use which python it will tell you where the python command is being resolved to. Typically, what happens is third parties redefine things in /usr/local/bin (which takes precedence, by default over /usr/bin). To fix, you can either run /usr/bin/python ...
4
57
0
I generally use Python 2.7 but recently installed Python 3.5 using Miniconda on Mac OS X. Different libraries have been installed for these two versions of python. Now, the entering either of the keywords 'python' or 'python3' in terminal invokes python 3.5, and 'python2' returns '-bash: python2: command not found'. Ho...
Switch between python 2.7 and python 3.5 on Mac OS X
1
0
0
157,702
34,686,119
2016-01-08T21:11:00.000
2
0
0
0
java,python,elasticsearch
36,937,080
1
true
1
0
You have to increase the content uploading length which is by default 100mb. Go to elasticsearch.yml in config folder add/update - http.max_content_length: 300M
1
3
1
I am trying to do bulk indexing in elasticsearch using Python for a big file (~800MB). However, everytime I try [2016-01-08 15:06:49,354][WARN ][http.netty ] [Marvel Man] Caught exception while handling client http tra ffic, closing connection [id: 0x2d26baec, /0:0:0:0:0:0:0:1:58923 => /0:0:0:0:0:0:0:...
Unable to do bulk indexing for large file in elasticsearch
1.2
0
0
2,316
34,687,794
2016-01-08T23:28:00.000
1
0
1
0
python,graphics,package
34,687,913
2
false
0
0
I believe that this can be done by firstly; creating a keyboard with Tkinter then depending on the frequency that the letters are in, define the shade of the button or box the letters are individually displayed as. For example if you set borderlines for say between; green, yellow, and red as, pressed between 1-10 then ...
1
0
0
I have data on how frequently certain keys are pressed on the keyboard stored in a dictionary. I want to be able to integrate that data with an on-screen keyboard with different shades to demonstrate the frequency distribution of keys' being pressed. What Python packages or integrations allow this?
Python package to display/interact with keyboard on-screen?
0.099668
0
0
147
34,692,370
2016-01-09T10:31:00.000
2
0
1
0
python,django,azure,pip,azure-web-app-service
41,843,617
5
false
1
0
You won't be able to upgrade the pip of your Django webapp because you will not have access to system files. Instead you can upgrade pip of your virtualenv, which you can do by adding a line in deploy.cmd file before install requirements.txt command. env\scripts\python -m pip install --upgrade pip Remember not to upgra...
2
9
0
I'm pretty new to Azure and I'm trying to get a Django WebApp up and running. I uploaded the files using FTP, But Azure doesn't run my requirements.txt. So I searched for a bit and found out that you can install the requirements.txtwith pip. Back in Azure, PIP doesn't seem to work. Neither in the Console, The KUDU ...
Using PIP in a Azure WebApp
0.07983
0
0
7,236
34,692,370
2016-01-09T10:31:00.000
2
0
1
0
python,django,azure,pip,azure-web-app-service
38,240,151
5
false
1
0
Have you tried upgrading pip with easy_install? The following worked for me in Azure kudu console: python -m easy_install --upgrade --user pip
2
9
0
I'm pretty new to Azure and I'm trying to get a Django WebApp up and running. I uploaded the files using FTP, But Azure doesn't run my requirements.txt. So I searched for a bit and found out that you can install the requirements.txtwith pip. Back in Azure, PIP doesn't seem to work. Neither in the Console, The KUDU ...
Using PIP in a Azure WebApp
0.07983
0
0
7,236
34,699,869
2016-01-09T22:53:00.000
1
0
1
0
python,tkinter,python-2.x
34,700,366
2
false
0
1
This is done mostly for user convinience. Consider the Image class from PIL/Pillow. It has a method to create a thumbnail out of an image, in the process resizing it. The method takes two arguments, the new size in a tuple and a resampling method. This can be antialias, bilinear, cubic, etc. These are internally repres...
2
1
0
I'm learning to use Tkinter and in the tutorials it tells me to import W from Tkinter, but W is just a str ("w"). My question is why use Tkinter.W not "w". Is it because Tkinter will sometimes have the var equal something else dependent upon system?
Python Tkinter: Why use Tkinter.W not str "w"
0.099668
0
0
535
34,699,869
2016-01-09T22:53:00.000
2
0
1
0
python,tkinter,python-2.x
34,703,004
2
true
0
1
I always use the string value. I see absolutely no benefit in using the constants. The chance of them changing is virtually zero. These constants have remained unchanged since Tkinter was created. tkinter takes backwards compatibility pretty seriously, so even if they are changed, the string values will undoubtedly co...
2
1
0
I'm learning to use Tkinter and in the tutorials it tells me to import W from Tkinter, but W is just a str ("w"). My question is why use Tkinter.W not "w". Is it because Tkinter will sometimes have the var equal something else dependent upon system?
Python Tkinter: Why use Tkinter.W not str "w"
1.2
0
0
535
34,700,577
2016-01-10T00:22:00.000
1
0
1
0
python,lxml,pypy,pyquery
36,188,448
2
true
0
0
Pypy 5.0 and lxml 3.6 are designed to work well with each other.
1
1
0
I'm trying to use pyquery with pypy but it depends on lxml2, which won't build under pypy. I know there's a lxml2 build that is meant to be used with pypy but I don't know how to make pyquery use that instead of the usual one.
How can I build pyquery for pypy?
1.2
0
0
89
34,700,802
2016-01-10T00:52:00.000
4
0
0
0
python,django,virtualenv,virtualenvwrapper
34,701,093
3
false
1
0
Basically you can put the virtual environment at any place that suits you and can be read by the user running the python process. For security reasons you should consider to create the ve as an other user so the process has no write access to it.
1
3
0
I'm in the process of deploying a Django site, and I'm using a virtualenv to keep my Python installation tidy. I'm trying to figure out where the virtual environment should be located in a production server environment. It seems like this should be super straightforward, but it's giving me a monster headache. Any he...
Location of virtualenv in production
0.26052
0
0
1,778
34,702,815
2016-01-10T06:38:00.000
12
0
0
0
python,pandas
56,676,656
2
false
0
0
It's more appropriate to use .pivot_table() instead of .groupby() when you need to show aggregates with both rows and column labels. .pivot_table() makes it easy to create row and column labels at the same time and is preferable, even though you can get similar results using .groupby() with few extra steps.
1
92
1
I just started learning Pandas and was wondering if there is any difference between groupby() and pivot_table() functions. Can anyone help me understand the difference between them. Help would be appreciated.
Pandas: group by and Pivot table difference
1
0
0
55,623
34,703,125
2016-01-10T07:28:00.000
0
1
0
0
python,cron
34,759,109
2
true
0
0
What I did was to create a demean service for my script(RelayControlMainGH.py) and start it upon bootup or it can be started anytime. Then in my script that creates the config file I added a stop and start of the demean so it can get the new config file and keep going. It works great!!
2
0
0
I have a script(RelayControlMainGH.py) that monitors temperature sensors and controls relays. It uses a while true statement with a time.sleep() and runs forever. I also created a script(GetTableTimes.py) that reads 3 database table files and when they get modified a script(CreateRelayControlConfig.py) re-creates the s...
start stop python script that gets created dynamically
1.2
0
0
122