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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
43,647,227 | 2017-04-27T01:37:00.000 | 1 | 0 | 0 | 0 | python,python-3.x,sqlite | 43,647,246 | 1 | true | 0 | 0 | Write an API on the remote server, yes. This could be hosted by a web framework of your choice.
You won't get a direct network connection to a file | 1 | 1 | 0 | I use SQLite3 in python because my school computers don't allow us to install anything to python so I used the pre installed SQLite3 module.
I'm working on a program whose back end relies on an SQLite3 database, however the databases are created and stored on their computer.
Is it possible for me to "Host" an SQLite3 ... | How to connect to SQLite3 database in python remotely | 1.2 | 1 | 0 | 1,615 |
43,650,119 | 2017-04-27T06:26:00.000 | 2 | 0 | 0 | 0 | python,nlp,named-entity-recognition,spacy | 48,454,088 | 1 | false | 0 | 0 | I'm not sure exactly what you want to do... but below are solutions for a few possibilities.
You have a complete list of the medicines/drugs of interest...
i. and you want a special rule for tokenisation of these strings: Would not recommend this approach but in principle you could add special cases to the Tokenizer.
... | 1 | 1 | 1 | I am using Spacy 1.8.0 with Python and I would like to use Spacy to do analysis on Medical Documents. There is a way off adding new entity types to spacy's named entity recognizer. However, is it possible to add the names of medicines/drugs as proper nouns to spcay's vocab? Or do they need to be added by training the s... | How to add proper nouns as vocab to Spacy models? | 0.379949 | 0 | 0 | 806 |
43,650,204 | 2017-04-27T06:31:00.000 | 0 | 0 | 0 | 0 | python,django,sqlite,amazon-web-services,amazon-elastic-beanstalk | 43,666,611 | 1 | false | 1 | 0 | Don't bundle the development .sqlite file with the production stuff. It needs to have its own .sqlite file and you just need to run migrations on the production one. | 1 | 0 | 0 | I am deploying a Django App using Elastic Beanstalk on AWS. The app has a function whereby user can register their details.
The problem is when I make small changes to my app and deploy this new version I loose the registered users since their information isn't in my local database (only the database on aws).
Is there ... | Update sqlite database based on changes in production | 0 | 1 | 0 | 137 |
43,651,453 | 2017-04-27T07:38:00.000 | 0 | 1 | 1 | 0 | python,import | 43,654,049 | 1 | false | 0 | 0 | Adding an answer as I don't have enough reputation to comment.
I tried this in my system, I am able to import all the modules/Classes mentioned in the question. I do see the OSRNG directory.
Are you sure you installed it properly? Try reinstalling it.
Also, are you using a virtualenv? If so, may be you forgot to activ... | 1 | 0 | 0 | I have problems with importing some functions in the file stored in other directories and importing random method from Crypto library.
I installed Python34 and PyCrypto 2.6.1 in window 7.
Here is my file structure
my_project
/dh
/__pycache__
/__init__.py
./lib
... | Python file structure about importing from other directories | 0 | 0 | 0 | 107 |
43,651,565 | 2017-04-27T07:43:00.000 | 0 | 1 | 0 | 0 | python,raspberry-pi,screen,light,kodi | 43,728,785 | 1 | false | 0 | 1 | ideally what you want would have been for the Kodi json api to support setting the screensaver, from what I understand it doesn't.
that said if your familiar with Python, and I'm not, you can develop a plug in that opens a socket (or communicates otherwise) with your program running on your pi, because from what I unde... | 1 | 1 | 0 | I'm using the Pi3 and the last jessie-lite OS, and I want to manage the brightness of the screen like Kodi does with the dim screensaver.
After some google searching I found some tips but nothing works.
I'll be using an external light sensor and I want to manage the brightness proportionally at the value sent by the ... | Dim a display with a raspberry | 0 | 0 | 0 | 678 |
43,651,802 | 2017-04-27T07:54:00.000 | 3 | 0 | 0 | 0 | python,pandas,dataframe | 43,651,884 | 2 | false | 0 | 0 | Maybe something like df[year] * 100 + df[month] would help. | 1 | 3 | 1 | I have 2 columns df[year] and df[month]. It has values ranging from 2000 to 2017 and month values 1 - 12.
How to combine these to another column which would contain the combined output.
Eg:
Year Month Y0M
2000 1 200001
2000 2 200002
2000 3 200003
2000 10 200010
Note : there is a 0 added in betw... | How to Combine 2 integer columns in a dataframe and keep the type as integer itself in python | 0.291313 | 0 | 0 | 3,502 |
43,658,543 | 2017-04-27T12:57:00.000 | 2 | 0 | 1 | 0 | ipython,anaconda,jupyter,conda | 43,660,435 | 1 | false | 0 | 0 | Ok, super easy answer but maybe not the best one.
jupyter stores kernels in in $HOME/.locals/share/jupyter/kernels
deleting this directory makes jupyter notebook work normal again.
rm -rf $HOME/.local/share/jupyter/kernels/* | 1 | 0 | 0 | i did a complete reinstall of anaconda by deleting.
rm $HOME/anaconda
I started with fresh new python environments but changed the names --> p34 to p36
Now when i start jupyter and want to run an notebook with python 3.6 i get an kernel error message saying it can not find the correct kernel env.
FileNotFoundError: ... | jupyter notebook file not found error after conda reinstall | 0.379949 | 0 | 0 | 1,923 |
43,660,353 | 2017-04-27T14:14:00.000 | 1 | 0 | 1 | 0 | python,class,module,readability | 43,661,711 | 2 | false | 0 | 0 | You can do as you please. If the code for your classes is short, putting them all in your main script is fine. If they're longish, then splitting them out into separate files is a useful organizing technique (that has the added benefit of the code in them no getting recompiled into byte-code everytime the the script th... | 1 | 0 | 0 | As I learn more about Python I am starting to get into the realm of classes. I have been reading on how to properly call a class and how to import the module or package.module but I was wondering if it is really needed to do this.
My question is this: Is it required to move your class to a separate module for a functio... | Is there a reason to create classes on seperate modules? | 0.099668 | 0 | 0 | 201 |
43,660,860 | 2017-04-27T14:36:00.000 | 3 | 0 | 0 | 0 | python,django | 43,661,039 | 1 | false | 1 | 0 | There are basically two kind of apps: your own project-specific apps, and generic reusable ones. Examples of reusable apps are the Django contrib's "admin" and "auth" apps. But there are hundreds of third-part reusable apps on the net, ranging from a couple helper functions to full-blown CMS or e-shop solutions.
The pr... | 1 | 4 | 0 | Django documentation version 1.11 states:
Your apps can live anywhere on your Python path. In this tutorial, we’ll create our poll app right next to your manage.py file so that it can be imported as its own top-level module, rather than a submodule of mysite.
Does this means that this is the recommended location for ... | Where to put apps in Django? | 0.53705 | 0 | 0 | 533 |
43,660,910 | 2017-04-27T14:38:00.000 | 10 | 0 | 1 | 0 | python,python-2.7,floating-point,int | 43,660,956 | 3 | false | 0 | 0 | round(n) is a function to round a float, int(n) will cast a float to an integer and will get rid of the decimal part by truncating it. | 1 | 20 | 0 | I've been playing around with python for a bit now and i've noticed a strange behavior that makes me curious: what is the difference between float(int(n)) and round(n)?
When should I use one, another or neither of them? | python difference between round and int | 1 | 0 | 0 | 28,533 |
43,661,027 | 2017-04-27T14:45:00.000 | 0 | 0 | 0 | 0 | python,numpy,scipy,py2exe | 43,688,972 | 1 | false | 0 | 0 | I managed to solve this problem and wanted to post the solution.
The link posted by J.J. Hakala, showed that an error with the same symptoms can occur with matplotlib because py2exe does not transfer some necessary dll's to the new dist directory. I was already transferring the dll's mentioned in that post manually, ho... | 1 | 0 | 1 | I've been using py2exe to package some scripts as executable, which has worked well until this error.
In one script I need to solve a straightforward system of linear equations. I've been doing this with scipy.linalg.lstsq.
The problem is that any script I package with any scipy.linalg or numpy.linalg command crashes a... | Python py2exe executable silent crash with scipy.linalg or numpy.linalg | 0 | 0 | 0 | 189 |
43,661,651 | 2017-04-27T15:12:00.000 | 0 | 0 | 0 | 0 | python,input,tensorflow,queue,pipeline | 43,662,378 | 1 | false | 0 | 0 | I assume you're using an RNN here, for an RNN to take a variable length array you're going to need to pad them with zeros to the batch length and pass in a value that tells the RNN how long each sequence is.
I'd suggest taking the same approach here. Pad them before passing them into the TF queue and pass in another va... | 1 | 0 | 1 | I have a list of arrays (could be numpy arrays or just list of int) of different lengths and I would like to feed it into some TensorFlow queue for testing a larger input pipeline -- instead of serializing them and re-read from file system. Is it possible? | Feeding a queue from a list of arrays of different lengths | 0 | 0 | 0 | 119 |
43,662,475 | 2017-04-27T15:51:00.000 | 2 | 0 | 1 | 0 | python,flask | 43,662,608 | 3 | false | 1 | 0 | What would be involved in setting up your production server to deploy everything it needs without packaging it up?
The right Python version
The right Python packages
Enough memory
Security to ensure that no one that has access to that box can suddenly commit changes to your repo
If you did package your webapp, you ca... | 1 | 3 | 0 | I've been looking into flask lately and when looking at the tutorial information on the flask website, they have you install the demo webapp as a python package.
I've seen this in some other demo flask webapps as well, but I haven't seen a reason why you would do this. The dev server renders the app without this and... | Why install flask webapp as a package? | 0.132549 | 0 | 0 | 1,356 |
43,662,743 | 2017-04-27T16:05:00.000 | 0 | 0 | 1 | 1 | python | 43,662,855 | 3 | true | 0 | 0 | It will rename it, which means the original file will be 'moved' to the destination. If you doubt it, just try it out with a test file | 1 | 0 | 0 | I am trying to figure out the best way to move one file from a specified folder into another specified folder using python. I managed to find two different ways to do that.
os.rename("path/to/current/filename.txt","path/to/new/desination/for/filename.txt")
shutil.move("path/to/current/filename.txt", "path/to/new/destin... | Will the file be removed from the current folder? | 1.2 | 0 | 0 | 56 |
43,668,307 | 2017-04-27T21:35:00.000 | 0 | 0 | 0 | 0 | python,algorithm,sorting,columnsorting | 43,733,509 | 4 | false | 0 | 0 | If n2 (and therefore n1) are both small, then you can find the n2 smallest elements and ignore the first n1 ones. These approaches are described by Arun Kumar and user448810 and will be efficient as long as n1 remains small.
However, you may be describing a situation in which n1 (and therefore n2) can grow (perhaps ev... | 2 | 0 | 1 | I have an array, I attempt to find the n1 th smallest number until the n2 th smallest number in the array and store them in another array of size n2-n1+1. Here n2>n1 and both are realtively small compared to the size of the array (for example, the array size is 10000, n1=5, n2=20).
I can sort this array first, and the... | Fast algorithm to find the n1 th smallest number to n2 th smallest number in an array | 0 | 0 | 0 | 115 |
43,668,307 | 2017-04-27T21:35:00.000 | 1 | 0 | 0 | 0 | python,algorithm,sorting,columnsorting | 43,670,278 | 4 | false | 0 | 0 | Since, the N1 and N2 are really small compared to size of array letus say N.
We can have an implementation in O(N2 * LogN) using min heap data structures.
Steps
Construct a min heap. Complexity of this operation will be O(N)
Loop for a range of 0 to N2:
Get the root element and call heapify. Ignore first N1 ele... | 2 | 0 | 1 | I have an array, I attempt to find the n1 th smallest number until the n2 th smallest number in the array and store them in another array of size n2-n1+1. Here n2>n1 and both are realtively small compared to the size of the array (for example, the array size is 10000, n1=5, n2=20).
I can sort this array first, and the... | Fast algorithm to find the n1 th smallest number to n2 th smallest number in an array | 0.049958 | 0 | 0 | 115 |
43,669,707 | 2017-04-27T23:48:00.000 | 1 | 0 | 1 | 0 | python,cocos2d-x | 43,671,941 | 2 | false | 0 | 1 | No it does not support python. Currently python is only used for compiling and generating in cocos2d-x. C++ and javascript are the best languages to develop with cocos2d-x, lua's documentation is poor and few developers are using it. | 2 | 1 | 0 | I think cocos2d-x should support python because it is a project forked from cocos2d. But according to their website, the only scripted languages they support are javascript and lua. So does it support python or not? If not, why? | Does cocos2d-x support python | 0.099668 | 0 | 0 | 1,099 |
43,669,707 | 2017-04-27T23:48:00.000 | 2 | 0 | 1 | 0 | python,cocos2d-x | 43,677,712 | 2 | true | 0 | 1 | No, you can't use python. You can use C++, javascript and Lua for development.
Cocos2d-x is a port of an Objective-C library which itself was a port of a Python library.
cocos2d, written in python language comes in starting of 2008 and after that in mid 2008 due to popularity of iphone, Cocos2D was ported to ObjectiveC... | 2 | 1 | 0 | I think cocos2d-x should support python because it is a project forked from cocos2d. But according to their website, the only scripted languages they support are javascript and lua. So does it support python or not? If not, why? | Does cocos2d-x support python | 1.2 | 0 | 0 | 1,099 |
43,669,897 | 2017-04-28T00:10:00.000 | 1 | 1 | 0 | 1 | python,atom-editor | 69,393,225 | 7 | false | 0 | 0 | Adding python to my path, (installed as C:\Program Files\Python39\Python.exe) worked, but only after restarting Atom. Make sure you do that. Looks like it doesn't dynamically watch and reload the path variable from the system ¯\_(ツ)_/¯ | 6 | 4 | 0 | I've researched this on different places, including stackoverflow, and I can't find an answer that helps me.
I'm using Windows 7, 64 bit, with Atom for 64 bit Windows. I have Python 3.6.1 installed in the directory C:\Users\Austin\Documents\Python. When I try to run a simple script to test Python in Atom, it says
'pyt... | Why can't Python run in Atom? | 0.028564 | 0 | 0 | 24,120 |
43,669,897 | 2017-04-28T00:10:00.000 | 0 | 1 | 0 | 1 | python,atom-editor | 71,393,101 | 7 | false | 0 | 0 | None of the above answers worked for me. What did work, is installing Python from the Microsoft Store instead of downloading from the web and installing from an installer. | 6 | 4 | 0 | I've researched this on different places, including stackoverflow, and I can't find an answer that helps me.
I'm using Windows 7, 64 bit, with Atom for 64 bit Windows. I have Python 3.6.1 installed in the directory C:\Users\Austin\Documents\Python. When I try to run a simple script to test Python in Atom, it says
'pyt... | Why can't Python run in Atom? | 0 | 0 | 0 | 24,120 |
43,669,897 | 2017-04-28T00:10:00.000 | 0 | 1 | 0 | 1 | python,atom-editor | 62,619,959 | 7 | false | 0 | 0 | I solved this issue, by put the good python path in Atom ide-Python
simply i put D:\my_python_folder\Python.exe | 6 | 4 | 0 | I've researched this on different places, including stackoverflow, and I can't find an answer that helps me.
I'm using Windows 7, 64 bit, with Atom for 64 bit Windows. I have Python 3.6.1 installed in the directory C:\Users\Austin\Documents\Python. When I try to run a simple script to test Python in Atom, it says
'pyt... | Why can't Python run in Atom? | 0 | 0 | 0 | 24,120 |
43,669,897 | 2017-04-28T00:10:00.000 | 0 | 1 | 0 | 1 | python,atom-editor | 46,919,992 | 7 | false | 0 | 0 | Reinstall the latest Python version. One of the first installation screens has a toggle box at the bottom that you can click to add the directory to Path. This worked for me when I ran into the same problem. You have to manually click though and it's easy to ignore it. | 6 | 4 | 0 | I've researched this on different places, including stackoverflow, and I can't find an answer that helps me.
I'm using Windows 7, 64 bit, with Atom for 64 bit Windows. I have Python 3.6.1 installed in the directory C:\Users\Austin\Documents\Python. When I try to run a simple script to test Python in Atom, it says
'pyt... | Why can't Python run in Atom? | 0 | 0 | 0 | 24,120 |
43,669,897 | 2017-04-28T00:10:00.000 | 0 | 1 | 0 | 1 | python,atom-editor | 43,669,935 | 7 | false | 0 | 0 | In very direct terms, it means that there is no executable file named python.exe in any dictionary in your search path (which I think is the PATH environment variable on Windows).
First of all, try executing python from the installation directory. If that works, you know that you have it installed properly, and that t... | 6 | 4 | 0 | I've researched this on different places, including stackoverflow, and I can't find an answer that helps me.
I'm using Windows 7, 64 bit, with Atom for 64 bit Windows. I have Python 3.6.1 installed in the directory C:\Users\Austin\Documents\Python. When I try to run a simple script to test Python in Atom, it says
'pyt... | Why can't Python run in Atom? | 0 | 0 | 0 | 24,120 |
43,669,897 | 2017-04-28T00:10:00.000 | 8 | 1 | 0 | 1 | python,atom-editor | 43,669,978 | 7 | true | 0 | 0 | Your issue is probably that your Python command is not listed in your PATH environment variable.
Environment Variables are paths, values and other information stored by your operating system and used globally by the OS and different applications you use.
The best example for a command listed in the PATH environment var... | 6 | 4 | 0 | I've researched this on different places, including stackoverflow, and I can't find an answer that helps me.
I'm using Windows 7, 64 bit, with Atom for 64 bit Windows. I have Python 3.6.1 installed in the directory C:\Users\Austin\Documents\Python. When I try to run a simple script to test Python in Atom, it says
'pyt... | Why can't Python run in Atom? | 1.2 | 0 | 0 | 24,120 |
43,670,334 | 2017-04-28T01:07:00.000 | 0 | 0 | 0 | 0 | python,database-design,web-scraping | 43,670,482 | 1 | false | 0 | 0 | In windows, you can use Task Scheduler or in Linux crontab. You can configure these to run python with your script at set intervals of time. This way you don't have a python script continuously running preventing some hangup in a single call from impacting all subsequent attempts to scrape or store in database.
To stor... | 1 | 0 | 1 | I have written a piece of python code that scrapes the odds of horse races from a bookmaker's site. I wish to now:
Run the code at prescribed increasingly frequent times as the race draws closer.
Store the scraped data in a database fit for extraction and statistical analysis in R.
Apologies if the question is poorly... | How to run python code at prescribed time and store output in database | 0 | 1 | 0 | 73 |
43,671,556 | 2017-04-28T03:36:00.000 | 1 | 0 | 0 | 0 | python,machine-learning,artificial-intelligence,data-analysis | 44,968,742 | 2 | false | 0 | 0 | you are asking "Incremental way of learning " !!
it's depends on what task are you doing. you can not apply incremental learning everywhere. the real problem is when we train , in the process of training , there are many other things that are related(inter dependent). which gets changed during a new cycle.
so if you ca... | 1 | 0 | 1 | I am kinda a newbie in machine learning. I have done lots of learning related to data analysis and ML algorithms, and I've got very good results and understanding of the algorithms. However, my approaches are normally getting datasets, writing scripts or notebooks to solve the problems and that's pretty much it. Which ... | How to build a machine learning system (smart system) that updates automatically? | 0.099668 | 0 | 0 | 405 |
43,671,704 | 2017-04-28T03:55:00.000 | 1 | 0 | 0 | 0 | python,algorithm,tree,random-forest,xgboost | 44,010,620 | 1 | false | 0 | 0 | You can dump the xgboost model into a text file, and parse it yourself. The file looks like this:
booster[0(<-tree id)]:
0(<-node id):[f317(<-feature name)<0.187154] yes=1(<-child node id),no=2,missing=1
1:[f317<0.071172] yes=3,no=4,missing=3
...
6379:leaf=0.125 (<-weight to that leaf)
At the e... | 1 | 1 | 1 | I'm using xgboost package in python and I'm going to extract tree structures after training. For instance, I'm going to know the feature and threshold that has been selected at each node to export the tree structures to a function.
Moreover, I need to know the weight of each tree after training. (As we know, the result... | Extracting weights and tree structures from xgboost - plot trees | 0.197375 | 0 | 0 | 1,889 |
43,672,788 | 2017-04-28T05:43:00.000 | 0 | 0 | 0 | 0 | javascript,python | 43,673,110 | 1 | false | 1 | 0 | Can you not call a specific page of your web application (assuming your web application uses some web framework developed in python) via ajax with javascript and does this page execute a Python function (under the table)? | 1 | 0 | 0 | Is there any such library available which allow to run python code or any executable binary on the client machine using JavaScript. I have a strange scenario. All client machine use a web application hosted on a server, but authentication should be done using a device in the client machine using ttyUSB0 interface. Sinc... | Call Python function from javascript inside client application | 0 | 0 | 1 | 66 |
43,674,393 | 2017-04-28T07:24:00.000 | 0 | 0 | 0 | 0 | python,arrays,algorithm,linked-list | 43,674,438 | 2 | false | 0 | 0 | I'd bet these are already implemented in numpy or scipy. | 1 | 0 | 1 | sparse
array objects will have a fixed size n set when they are created - attempting to set or get elements larger
than the size of the array should raise an IndexError | I need to implement a SparseArray with a linked list implementation | 0 | 0 | 0 | 238 |
43,677,809 | 2017-04-28T10:17:00.000 | 2 | 0 | 0 | 0 | python,database,elasticsearch,scrapy,nosql | 43,679,611 | 1 | true | 1 | 0 | That very much depends on what you are planning to do with the scraped data later on.
Elasticsearch does some complex indexing operations upon insertion which will make subsequent searches in the database quite fast ... but this also costs processing time and introduces a latency.
So to answer your question whether El... | 1 | 3 | 0 | I'm currently building a scrapy project that can crawl any website from the first depth to the last. I don't extract many data, but I store the all page HTML (response.body) in a database.
I am currently using Elasticsearch with the bulk API, to store my raw HTML.
I had a look in Cassandra but I did not find an equival... | Scrapy - Database choice | 1.2 | 0 | 0 | 796 |
43,680,502 | 2017-04-28T12:40:00.000 | 0 | 0 | 0 | 0 | python,django,google-chrome | 63,429,211 | 3 | false | 1 | 0 | I reset my chrome setting and it worked fine.
In Chrome, click on the 3 dots on the far right and goto settings.
On settings page, scroll all the way down or click on the bottom left "Reset Settings" button and reset settings. | 1 | 1 | 0 | I recently started playing with Django.
When I try to log in into the admin panel, it succeeds in Firefox but doesn't in Google Chrome.
This is the error i get :
Forbidden (CSRF cookie not set.): /admin/login/
My cookies are enabled in Chrome for every website. Is there a specific reason why it would work in Firefox b... | Django let me log in in Firefox but not in chrome | 0 | 0 | 0 | 258 |
43,681,816 | 2017-04-28T13:48:00.000 | 0 | 0 | 1 | 0 | python,ipython-notebook,reusability,code-reuse | 55,919,023 | 1 | false | 0 | 0 | I see this is an old question, but I want to answer it if someone still looks it up.
P.S. It would also be nice to be able to import Python files into a Notebook. Is it possible?
You can import any python script (filexy.py) from the same folder as your notebook by simply stating import filexy.
Relating to that, I'd s... | 1 | 3 | 0 | Is it possible to plug IPython notebook into existing Python project and to be able to reuse some of the existing code w/o copy-pasting it into a notebook?
I am looking for a way to use IPython Notebooks as a part of a large Python project to quickly test hypothesis and to analyze data on the spot.
P.S. It would also b... | IPython Notebook: code reuse | 0 | 0 | 0 | 412 |
43,684,654 | 2017-04-28T16:13:00.000 | 2 | 0 | 1 | 0 | python,machine-learning | 43,684,698 | 2 | false | 0 | 0 | If you have the lists of typical Chinese and English names and the problem is performance only, I suggest you convert the lists into sets and then ask for membership in both sets as this is much faster than finding out whether an element is present in a large list. | 1 | 2 | 0 | Given a bunch of names, how can we find out which are Chinese names and which are English names? For the Chinese names, I build a list of the Chinese last names to find out the Chinese names. For example, Bruce Lee, Lee is a Chinese last name, so we regard Bruce Lee is a Chinese name. However, the Chinese last names li... | How to recognize Chinese or English name using python | 0.197375 | 0 | 0 | 1,206 |
43,690,386 | 2017-04-28T23:58:00.000 | -3 | 0 | 1 | 1 | python,windows,python-2.7,python-3.x,path | 44,543,461 | 2 | false | 0 | 0 | Easy solution.
My last installation was python 3.6 (folder name Python36-32).
I just changed folder name to something like Python36-32- and now python 2.7 running. | 2 | 4 | 0 | I have python v2.7 and 3.6 on Windows 10. I installed 3.6 later and also chose the option "Add to PATH". In the command line, when I type python, I get v3.6. I already tried to set PATH in View Advanced System Settings, but it doesn't work and python 3.6 is also no where to be found there. So when I want to set v2.7 as... | How can I change default Python version on the cmd in Windows 10 | -0.291313 | 0 | 0 | 14,145 |
43,690,386 | 2017-04-28T23:58:00.000 | 7 | 0 | 1 | 1 | python,windows,python-2.7,python-3.x,path | 43,709,974 | 2 | false | 0 | 0 | For running Python 3 on your computer from the Command Prompt: enter py -3.6 myfile.py
For running Python 2.7: py -2.7 myfile.py
This also works if you have Python 3.4 and Python 3.6 installed, just change the argument. | 2 | 4 | 0 | I have python v2.7 and 3.6 on Windows 10. I installed 3.6 later and also chose the option "Add to PATH". In the command line, when I type python, I get v3.6. I already tried to set PATH in View Advanced System Settings, but it doesn't work and python 3.6 is also no where to be found there. So when I want to set v2.7 as... | How can I change default Python version on the cmd in Windows 10 | 1 | 0 | 0 | 14,145 |
43,690,408 | 2017-04-29T00:00:00.000 | 2 | 0 | 1 | 0 | python | 43,690,847 | 2 | false | 0 | 0 | There are three problems here.
Your program tries to read the same physical file in several threads at once. That doesn't make sense and probably isn't feasible at the OS or hardware level. What is feasible is first to read the entire file into several strings, in the main thread, and then operate on the strings (n... | 1 | 0 | 0 | I'm trying to use multi-threading in Python in order to go through a large file of text (characters) and count recurrences of the same characters.
How can I go about setting it up so that I can use the above to methods with multiple threads and process a file to count the recurrences of a character? | Multi-threading to count recurrences of characters in a file | 0.197375 | 0 | 0 | 560 |
43,690,635 | 2017-04-29T00:35:00.000 | 2 | 0 | 1 | 0 | python,amazon-web-services,authentication,resources,limit | 43,692,199 | 1 | false | 1 | 0 | This is not possible.
The permission model in AWS controls whether or not a set of credentials is permitted to make a particular API call. The credentials can be time-limited and API calls can be restricted by things like IP address, but it is not possible to limits API calls by quantity.
This need is usually addressed... | 1 | 0 | 0 | I am currently using boto3 to sign users up inside a UserPool with cognito. I'd like to allow a policy for these users to be able to synthesize speech in Amazon Polly. However, I am not sure how to set a limit to the number of times they can call this?
I would like to be able to sell a tier service, i.e. tier 1 can r... | How to set quota or limit to aws cognito user? | 0.379949 | 0 | 0 | 1,412 |
43,691,131 | 2017-04-29T02:10:00.000 | 1 | 0 | 1 | 0 | python,list,iterator,integer,listiterator | 44,217,428 | 4 | false | 0 | 0 | I agree with Efron Licht, clearly: It entirely depends on complexity of particular list to compact (not to say 'compress'). Unless your lists are simple enought to express as generators, your only choice is to use Bartek Jablonski answer. | 1 | 7 | 0 | Say I have a very large list of integers that occupies a very large amount of memory. If the list's integers were in even increments, I could then easily express the list as an iterator occupying comparatively no memory. But with more complicated patterns, it would become more difficult to express this list as an itera... | How to create an optimized iterator for a long list of integers? | 0.049958 | 0 | 0 | 251 |
43,696,445 | 2017-04-29T13:50:00.000 | 0 | 0 | 1 | 0 | python,import,package,circular-dependency | 43,702,187 | 2 | true | 0 | 0 | So I came across a hack to fix my problem. Figured I'd share it.
My __ init __.py now looks like this:
class CrazyHack(object):
@property
def DestroyInterface(self):
import crazyhackthing.destroyinterface
return destroyinterface.DestroyInterface
@property
def GraphicInterface(self):
... | 1 | 2 | 0 | I've run into a circular import problem because I need to import only part of a package. When my program starts, I create a driver class which inherits from a class defined in a package, but another irrelevant part of that package imports the driver; I need to stop the irrelevant part of the package from running until ... | Importing only part of a package to avoid circular import | 1.2 | 0 | 0 | 452 |
43,696,735 | 2017-04-29T14:20:00.000 | 0 | 0 | 1 | 1 | python,windows,python-3.x,automation,windows-10 | 59,797,481 | 4 | false | 0 | 0 | You can use this new technique, its called winapps its used for searching, modifying, and uninstalling apps. Its download command on cmd windows is pip install winapps. | 1 | 2 | 0 | So, as you may know there are certain apps on Windows that can be installed from the app store, and are classified as Windows Trusted Apps. I am not sure, but I think these do not use the classic .exe format. So I am writing a python script to automate some stuff when I start my pc, and I need to start a certain Window... | How can I open a Windows 10 app with a python script? | 0 | 0 | 0 | 11,049 |
43,697,351 | 2017-04-29T15:22:00.000 | 2 | 0 | 1 | 0 | python,regex,django,django-urls | 43,697,484 | 1 | true | 1 | 0 | You can use this regex for your purpose: "^[a-zA-Z][a-zA-Z0-9_@]*$" | 1 | 1 | 0 | I need to pass username in my URL.
username can be any combination of letter, numbers and special characters like @,_.
also, username starts with a letter.
username examples: test@1, test_1,test2_1990, | Regex to match combination of letter and numbers to be used in URL pattarns in Django Project? | 1.2 | 0 | 0 | 1,512 |
43,701,647 | 2017-04-30T00:06:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,asynchronous,python-asyncio | 46,858,792 | 3 | false | 0 | 0 | Yes, this is possible to executed multiple __anext__ tasks simultaneously. As with any other generator, every call to __anext__ will execute until first yield (await is yield from).
Whether this is safe or unsafe depends on the implementation:
Implementation that enforces order via queue or other synchronization primi... | 1 | 5 | 0 | If __anext__ gives control back to event loop (via an await, or call_soon/call_later), is it possible for another __anext__ to be called on the same instance, while first one had not resolved yet, or they would be queued? Are there any other cases where it would be unsafe to assume that only one __anext__ is running at... | Semantics of `async for` - can __anext__ calls overlap? | 0 | 0 | 0 | 2,814 |
43,703,285 | 2017-04-30T05:37:00.000 | 4 | 0 | 1 | 0 | python,destructor | 43,703,338 | 2 | true | 0 | 0 | No, del merely deletes the name. If the object referenced by that name has other references, it will continue to exist. The __del__ method is not guaranteed to be called even when there are no references to the object.
If you need predictable object lifespan and the ability to clean up after yourself, use a context man... | 1 | 0 | 0 | Is it compulsory to use __del__ method in all custom created classes? Is the del command a destructor? | is it compulsory to use __del__ method in all custom created classes , is del command a destructor | 1.2 | 0 | 0 | 48 |
43,704,747 | 2017-04-30T09:08:00.000 | -1 | 0 | 1 | 0 | python,debugging,visual-studio-code | 61,331,719 | 9 | false | 0 | 0 | If you are using a virtual environment, be sure to use the full path to the environment's Python interpreter. | 1 | 55 | 0 | Is there an easy way to run a Python file inside Visual Studio Code with arguments?
I know I can add a custom configuration in the launch.json file with the args keyword. However, it is annoying to modify the launch.json file every time just because I want to use different arguments. | Visual Studio Code: run Python file with arguments | -0.022219 | 0 | 0 | 71,425 |
43,706,048 | 2017-04-30T11:50:00.000 | 1 | 0 | 0 | 0 | python,ajax,django,asynchronous,backend | 43,707,120 | 2 | false | 1 | 0 | I finally solved this problem by using python subprocess
I make my "compute" code in a separate file and use the Popen to call it.
from subprocess import Popen
def submit(request):
#some prepare
........
# call the engine
p = Popen(["python", "compute.py", <arguments>])
return HttpResponse("s... | 2 | 1 | 0 | I am recently using Django to program my web interface for my "scientific computing engine".
I wrap the "computing engine" as a python module and call it inside the Django Framework.
The compute() function of the "engine" takes several minutes to run (I use ajax to trigger it) , at the same time, I let the front-end m... | Django not response to Ajax call while doing a computing intensive task | 0.099668 | 0 | 0 | 94 |
43,706,048 | 2017-04-30T11:50:00.000 | 1 | 0 | 0 | 0 | python,ajax,django,asynchronous,backend | 43,706,191 | 2 | false | 1 | 0 | It's never a good idea to start threads from views like that.
The most common way to solve this is to delegate the work to a separate worker/process. In addition to django you have another python process looking for work.
You can keep it simple and make the Django view store information about the work that needs to be... | 2 | 1 | 0 | I am recently using Django to program my web interface for my "scientific computing engine".
I wrap the "computing engine" as a python module and call it inside the Django Framework.
The compute() function of the "engine" takes several minutes to run (I use ajax to trigger it) , at the same time, I let the front-end m... | Django not response to Ajax call while doing a computing intensive task | 0.099668 | 0 | 0 | 94 |
43,709,095 | 2017-04-30T17:10:00.000 | -1 | 0 | 1 | 0 | python,python-3.x | 43,709,925 | 3 | false | 0 | 0 | Use pip install random. That works with every Python distribution. | 2 | 2 | 0 | I am trying to download the random module and was wondering if I copy a code and put it in a file editor, how do I go about installing it through pip? I placed the code in notepad and saved it on my desktop as random.py. What do I do now so that I can get this in installed through anaconda? I tried pip install random.p... | Downloading Random.py Using Anaconda | -0.066568 | 0 | 0 | 11,349 |
43,709,095 | 2017-04-30T17:10:00.000 | 0 | 0 | 1 | 0 | python,python-3.x | 43,709,432 | 3 | false | 0 | 0 | If using python3, it will simply be
pip3 install random
as @Remi stated. | 2 | 2 | 0 | I am trying to download the random module and was wondering if I copy a code and put it in a file editor, how do I go about installing it through pip? I placed the code in notepad and saved it on my desktop as random.py. What do I do now so that I can get this in installed through anaconda? I tried pip install random.p... | Downloading Random.py Using Anaconda | 0 | 0 | 0 | 11,349 |
43,710,285 | 2017-04-30T19:09:00.000 | 2 | 0 | 1 | 0 | python,windows,python-3.x,installation | 43,727,315 | 1 | true | 0 | 0 | These are all interchangeable, so no worries. They are needed for compatibility based on different system setups. ActivePython has a long history and builds on multiple platforms, so all precautions are taken. | 1 | 2 | 0 | I just installed the 64 bit edition of ActivePython 3.6, and discovered that it contains three executable files that report identical version information and are the same size, but not entirely identical, peer fc.exe. I have
python.exe
python3.exe
python3.6.exe
Though I could probably use something along the lines o... | What is the difference between python.exe, python3.exe, and python3.6.exe? | 1.2 | 0 | 0 | 6,622 |
43,711,437 | 2017-04-30T21:20:00.000 | 1 | 1 | 1 | 0 | python,math,mathematical-expressions | 43,711,560 | 1 | false | 0 | 0 | If you trust the user, you could input a string, the complete function expression as it would be done in Python, then call eval() on that string. Python itself evaluates the expression. However, the user could use that string to do many things in your program, many of them very nasty such as taking over your computer o... | 1 | 1 | 0 | I have a work to do on numerical analysis that consists on implementing algorithms for root-finding problems. Among them are the Newton method which calculates values for a function f(x) and it's first derivative on each iteraction.
For that method I need a way to the user of my application enter a (mathematical) func... | Mathematical functions on Python 3 | 0.197375 | 0 | 0 | 239 |
43,719,408 | 2017-05-01T12:53:00.000 | 0 | 0 | 1 | 1 | python | 43,719,629 | 3 | false | 0 | 0 | You mention trying "pip" while the documentation clearly mentions "pip3". On certain systems there's a difference. | 3 | 0 | 0 | I have installed Homebrew which includes pip, doesn't it?
But when I type $ pip install requests, in terminal, it shows
-bash: pip: command not found | Install requests by pip, but it doesn't work | 0 | 0 | 0 | 150 |
43,719,408 | 2017-05-01T12:53:00.000 | 1 | 0 | 1 | 1 | python | 43,719,472 | 3 | true | 0 | 0 | Homebrew is a Mac package manager. You can use it to install pip, among other things, but it doesn't do so until you tell it to. | 3 | 0 | 0 | I have installed Homebrew which includes pip, doesn't it?
But when I type $ pip install requests, in terminal, it shows
-bash: pip: command not found | Install requests by pip, but it doesn't work | 1.2 | 0 | 0 | 150 |
43,719,408 | 2017-05-01T12:53:00.000 | 0 | 0 | 1 | 1 | python | 43,719,495 | 3 | false | 0 | 0 | Not as far is I know - you'd need to install python which should include pip. | 3 | 0 | 0 | I have installed Homebrew which includes pip, doesn't it?
But when I type $ pip install requests, in terminal, it shows
-bash: pip: command not found | Install requests by pip, but it doesn't work | 0 | 0 | 0 | 150 |
43,720,595 | 2017-05-01T14:17:00.000 | 1 | 0 | 0 | 0 | revit-api,revit,revitpythonshell,pyrevit | 43,727,921 | 1 | true | 1 | 0 | UIDocument.ShowElements( ICollection ids); | 1 | 1 | 0 | In the User Interface Revit has a "select element by ID" which has a "Show" button. I'm able using RPS and a custom pyrevit code to select the elements, however I'd like to give my users the ability to scan through all the views and open views where the element is visible similar to the "Show" button. Before going th... | Run the "Show" Feature of "Select Elements by ID" using API Revit | 1.2 | 0 | 0 | 1,445 |
43,722,940 | 2017-05-01T16:52:00.000 | 1 | 0 | 0 | 0 | python,css,django,web,sass | 43,750,155 | 1 | true | 1 | 0 | In my opinion, sass files are frontend's stuffs so i will put it in static. | 1 | 2 | 0 | I want to use SASS in my Django Project. But where should I put all my Sass files ? Should I create a 'Sass' folder in my Project Folder or is it better to create for each App a 'Sass' folder.
And which converter would you recommend to convert my sass files to css ? | Adding Sass to Django | 1.2 | 0 | 0 | 553 |
43,724,600 | 2017-05-01T18:45:00.000 | 0 | 0 | 0 | 0 | python,3d,rendering,render | 54,512,055 | 3 | false | 0 | 0 | nVidia's iRay is excellent however, 50k plus triangles is a serious task for any rendering engine.
If you're looking for photorealistic quality you'll be looking at several minutes per render at 50k triangles from a simple lighting source.
The more complex your lighting becomes the slower the process. A simple texture ... | 1 | 5 | 1 | I'm a working a neural network that does face reconstruction from a single image using tensorflow.
I'm trying to figure out how to render the output of the network (which is a 3D mesh) into an image in python.
Most of the libraries I found do 3D rendering in real time, I'm only looking to render and single frame.
I als... | Rendering a 3D mesh into an image using python | 0 | 0 | 0 | 11,128 |
43,725,625 | 2017-05-01T19:59:00.000 | 0 | 0 | 1 | 0 | python,websocket,listener | 55,833,478 | 4 | false | 0 | 0 | Using websockets and asyncio it is easy. Connect two sockets and run listeners on it. Depending on where message handling should happen, either in a forever running coroutine which handles messages on its own or by a higher level handler coroutine which asyncio.waits two listener tasks essentially awaiting ws.recv(). | 2 | 0 | 0 | I am trying to create a python program which will listen to 2 websockets for unlimited time , websockets will be used as one way pipeline and each socket will store data in one variable when new data comes the old data will be replaced.
What will be the best way to do it ? I was looking for Websocket server but i wonde... | Python websocket listener | 0 | 0 | 1 | 3,757 |
43,725,625 | 2017-05-01T19:59:00.000 | 0 | 0 | 1 | 0 | python,websocket,listener | 43,742,288 | 4 | false | 0 | 0 | I need to listen to exactly 2 ports like for example 8888 and 8889 the data on ports will be true and false and i should be able to get data to main program , so i can do something if both ports are true for example. | 2 | 0 | 0 | I am trying to create a python program which will listen to 2 websockets for unlimited time , websockets will be used as one way pipeline and each socket will store data in one variable when new data comes the old data will be replaced.
What will be the best way to do it ? I was looking for Websocket server but i wonde... | Python websocket listener | 0 | 0 | 1 | 3,757 |
43,727,210 | 2017-05-01T22:07:00.000 | 3 | 0 | 1 | 0 | python,parsing,abstract-syntax-tree,introspection | 43,727,741 | 4 | true | 0 | 0 | I grep for function usage fairly regularly. Fortunately, I have never been interested in something that would be duplicated so heavily.
Here is what I might do, rather than write one-time code, if the false hits for Class.method were too common to filter manually. First grep for class Class to find the module with th... | 1 | 2 | 0 | Let's say you have a particular method (function) from a particular module
(of a particular class, optional). Is it possible via introspection of the library source code print all the lines where that method is called (used)?
It can be called internally (with self.method_name()) or externally with
(object1.method_name(... | Show lines where a particular method is called | 1.2 | 0 | 0 | 981 |
43,728,508 | 2017-05-02T00:51:00.000 | 0 | 0 | 1 | 1 | python,windows,python-3.x,autobahn | 43,728,509 | 1 | true | 0 | 0 | Simply use the following command on your Windows system:
pip install autobahn
And yes, I created (and self-answered) this entire question just in order to help others avoid the same apparent extreme lack of (efficiently Google-indexed at least) explicit internet documentation on how to achieve this, that I had to suf... | 1 | 0 | 0 | I'm trying to install Autobahn on Python 3.6.0 on Windows, for use only with asyncio rather than Twisted (i.e. I don't need Twisted at all).
I know it should be possible to install only Autobahn, lean-and-mean, without needing the entire Crossbar package bloat (where the latter requires Python build tools and whatnot, ... | How can I install Autobahn only (for use only with asyncio rather than Twisted), without the entire Crossbar package bloat, in Python 3 on Windows? | 1.2 | 0 | 0 | 193 |
43,728,696 | 2017-05-02T01:21:00.000 | 0 | 0 | 0 | 1 | apache-kafka,kafka-producer-api,kafka-python | 43,740,571 | 1 | false | 0 | 0 | Did you change the acks config of producer? From you description it seems that acks is set to all, so producer waits untill the sent data will be replicated among three brokers which affects throughput. If you didn't change the acks try to set it to 0, so producer will not wait for any acknowledgment from the server at... | 1 | 0 | 0 | I have a kafka producer belonging to client with clientid - "p1" and quota as 50 MBps.
Now I tested the performance of my producer using "bin/kafka-producer-perf-test.sh" and I was able to get throughput close to 50 MBps when writing to a partition without a replica.
I tried the same experiment on a partition with th... | Can kafka producers supply data at quota rate in presence of replicas? | 0 | 0 | 0 | 77 |
43,729,449 | 2017-05-02T03:10:00.000 | 0 | 0 | 1 | 0 | python,list | 43,729,478 | 2 | false | 0 | 0 | python has this great built in array function called index that will take care of what you need.
in your example: x = b[a.index(5)] which takes a and gets the index of 5 (which is 4) and then assigns the item in b at that index to the variable x so that you can do whatever evaluations you may need. | 1 | 0 | 0 | ...and compare it with another list to get the same item in the same index/position.
Eg.
a = [1, 2, 3, 4, 5]
b = [a, b, c, d, e]
I want the highest number in list a so:
5
And then, I compare it with list b to get the item, which is on the same position as the highest number in list a:
e
I apologize for the poorly w... | Python - How to find an item in a list | 0 | 0 | 0 | 82 |
43,730,740 | 2017-05-02T05:33:00.000 | 1 | 0 | 0 | 0 | python-3.x,tensorflow,deep-learning | 43,735,408 | 1 | true | 0 | 0 | You could set your padded cells to a value close to -Infinity (i.e. very small compared to your other logits), so that their contributions are just negligible. | 1 | 1 | 1 | I have a matrix where each row is padded to maxlen. If I apply softmax on the matrix, the padded indices are also considered. How to apply softmax on the matrix while considering only the non-padded indices?
Note: padded length in each row of the matrix would differ. | How to avoid padded indices during calculation of softmax using tf.nn.softmax? | 1.2 | 0 | 0 | 302 |
43,730,867 | 2017-05-02T05:43:00.000 | 1 | 1 | 0 | 0 | python,twitter,save,tweepy | 43,730,944 | 2 | false | 0 | 0 | You can try executing/calling your program by the command line interface and schedule a task using the embedded in windows- Windows Scheduler. There are many alternatives but that is the easiest I found when I did such task few months ago. | 1 | 2 | 0 | I'm doing a tweepy crawling.
I want the program to run automatically every 12 hours
Could you tell me the syntax?
I'm doing it with Python, and I have all the tweepy crawling code. | i want your help abut program to run automatically every 12 hours | 0.099668 | 0 | 1 | 59 |
43,731,132 | 2017-05-02T06:05:00.000 | 0 | 0 | 0 | 0 | python,facebook,facebook-graph-api,facebook-ads-api | 44,020,372 | 1 | true | 1 | 0 | The first thing is to try is to add the limit parameter, which limits the number of results returned per page.
However, if the account has a large amount of history, the likelihood is that the total amount of data is too great, and in this case, you'll have to query ranges of data.
As you're looking for data by indiv... | 1 | 0 | 0 | Is it possible to get lifetime data from using facebookads api on python? I tried to use date_preset:lifetime and time_increment:1, but got a server error instead. And, then I found this on their website:
"We use data-per-call limits to prevent a query from retrieving too much data beyond what the system can handle. Th... | Get all data since creation until today from ad account using facebook ads api for python | 1.2 | 0 | 1 | 108 |
43,733,387 | 2017-05-02T08:29:00.000 | 2 | 0 | 0 | 1 | python,django,celery | 43,733,656 | 5 | false | 1 | 0 | There is django-celery-beat package which allows you to dynamicly add tasks to database and then they are executed as you defined in database.(e.g. every 5 minutes) But currently they have bug which causes that task is not appended to celery queue when added to database. One suggested workaround is to restart celery pr... | 1 | 6 | 0 | I need to build an app in Django that lets the user do some task everyday at the time they specify at runtime.
I have looked at Celery but couldn't find anything that will help. I found apply_async and I can get the task to execute once at the specificied duration but not recurrent. I am missing something but don't kn... | How to dynamically schedule tasks in Django? | 0.07983 | 0 | 0 | 6,721 |
43,736,100 | 2017-05-02T10:53:00.000 | 0 | 0 | 1 | 0 | json,selenium,cucumber,bdd,python-behave | 64,931,158 | 1 | false | 0 | 0 | I cannot offer an example at the moment, but I would create the JSON file as needed and give reference to the JSON file in Given or Background , then capture the value in the respective decorated method. | 1 | 0 | 0 | I was using Behave and Selenium to test on something that use a large amount of data. Data tables were becoming too big and making the Gherkin documentation unreadable.
I would like to move most of the data from data tables to external file such as JSON. But I couldn't find any examples on websites. | Move Gherkin's (i.e. Cucumber and Behave) Data Table to JSON | 0 | 0 | 1 | 1,133 |
43,739,415 | 2017-05-02T13:40:00.000 | 51 | 0 | 0 | 0 | python,amazon-web-services,amazon-s3,boto3 | 43,744,495 | 3 | true | 0 | 0 | The upload_file method is handled by the S3 Transfer Manager, this means that it will automatically handle multipart uploads behind the scenes for you, if necessary.
The put_object method maps directly to the low-level S3 API request. It does not handle multipart uploads for you. It will attempt to send the entire body... | 1 | 49 | 0 | I'm using boto3 and trying to upload files. It will be helpful if anyone will explain exact difference between file_upload() and put_object() s3 bucket methods in boto3 ?
Is there any performance difference?
Does anyone among these handles multipart upload feature in behind the scenes?
What are the best use cases ... | What is the Difference between file_upload() and put_object() when uploading files to S3 using boto3 | 1.2 | 1 | 1 | 16,616 |
43,739,576 | 2017-05-02T13:47:00.000 | 0 | 0 | 0 | 0 | python,sockets | 43,740,468 | 3 | false | 0 | 0 | I think your critical question is how to hot reload.
And as mentioned by @gavinb, you can import importlib and then use importlib.reload(module) to reload a module dynamically.
Be careful, the parameter of reload(param) must be a module. | 1 | 2 | 0 | I've been scratching my head trying to figure out if this is possible.
I have a server program running with about 30 different socket connections to it from all over the country. I need to update this server program now and although the client devices will automatically reconnect, its not totally reliable.
I was wonder... | Python 3 Sockets - Can I keep a socket open while stopping and re-running a program? | 0 | 0 | 1 | 370 |
43,739,684 | 2017-05-02T13:51:00.000 | 0 | 0 | 0 | 1 | windows,python-2.7,opencv | 65,209,790 | 1 | false | 0 | 0 | You need to build it using CMake. | 1 | 1 | 1 | I am using OpenCV in windows. When I am using this command in windows command prompt then I am getting an error as opencv_annotation is not recognised as the internal or external command.
opencv_annotation --annotations=/C:\Users\harsh\Desktop/annotation.txt --images=C:\Users\harsh\Desktop/pos/ | opencv_annotation not recognised by windows | 0 | 0 | 0 | 743 |
43,740,269 | 2017-05-02T14:20:00.000 | 0 | 0 | 0 | 0 | python,django | 43,740,807 | 1 | true | 1 | 0 | The problem is overhead of compiling Templates when rendering. So the more complicated the template gets (method calls etc), the performance tends to get slow (like py files are converted to pyc). Django has template caching but that also is limited (I don't know how much). I have faced performance issue because of lot... | 1 | 0 | 0 | I have some text fields in my Django model that are filled by a script, with values in English (the list of values is known).
But the app is actually made for Russian clients only. I'd like to translate those fields into Russian, and here comes a little question. These values are taken from an API response, which mean... | Django. Check in template or use an extra field? | 1.2 | 0 | 0 | 40 |
43,741,348 | 2017-05-02T15:06:00.000 | 1 | 1 | 0 | 0 | python,ubuntu,slack | 43,741,656 | 1 | false | 0 | 0 | Ubuntu will keep track of any authentication (either login or sudo) attempts through /var/log/auth.log. Keep track of that file (or read up on how log entries are written to it) and you can then send notification to any other channel as the entries arrive. | 1 | 0 | 0 | I have a ubuntu server where a number of users login, i need to monitor who logs in. I am thinking of a pythonic way or anything better because i need to send the notification to slack.
So what i meant is , a python script sends notification to slack only when a user successfully logs in. I can write the slack integrat... | How to run a python script and see who logged in | 0.197375 | 0 | 0 | 365 |
43,745,458 | 2017-05-02T19:07:00.000 | 0 | 0 | 1 | 1 | python,python-3.x | 43,745,649 | 1 | false | 0 | 0 | Have you tried using virtual environments when working with multiple Python versions? | 1 | 3 | 0 | BLUF: Python 3.6 (x86) will NOT execute on Windows
OS: Windows 10E
x64 Python: 2.7 (working) (c:\python27)
Python 3.6 (not working) (c:\python36)
I've been running two installs of python for a couple years now, with no issues. Python 2.7 and 3.6, I usually use a python launcher (pywin or winpython) to call either ins... | Can't launch python3.6 on windows: "Current thread 0x00004d18" | 0 | 0 | 0 | 1,954 |
43,747,034 | 2017-05-02T20:53:00.000 | 6 | 0 | 1 | 1 | python,ubuntu,pip,permission-denied,setup.py | 43,747,532 | 2 | false | 0 | 0 | Ok, so I f***ed up so much:
After using sudo, package files were created in the location of my setup.py and they had lock icon (system files because of sudo) and I could no longer install program without sudo.
My solution was to sudo rm -r all of the previously created locked files in program directory and those near p... | 1 | 8 | 0 | I have a project with some structure, it is console script. The project has setup.py file.
All I want is to install my package any way without using sudo.
I spent like 10 hours browsing the internet and can't find a working solution.
I keep getting error: [Errno 13] Permission denied: 'srm.egg-info/PKG-INFO' if using v... | python setup.py install without sudo | 1 | 0 | 0 | 5,190 |
43,753,657 | 2017-05-03T07:21:00.000 | 2 | 0 | 1 | 0 | python,package,conda,update-all | 69,159,421 | 3 | false | 0 | 0 | Another simple method: conda update --all python=3.5.2
Replace the python version with your currently installed version. This will update all packages, and since the target version for python is already installed, it will not be updated. This also works with multiple packages: conda update all python=3.5.2 spyder=3.3.6... | 2 | 4 | 0 | I am a beginner in python and I am using an older version of anaconda which has the 3.5.2 version of python, because I would like to use tensorflow with it. I have some outdated packages that I would like to update with "conda update all". Is there a way to do this without updating python from 3.5 to 3.6, which is inco... | Conda update packages except python | 0.132549 | 0 | 0 | 3,122 |
43,753,657 | 2017-05-03T07:21:00.000 | 2 | 0 | 1 | 0 | python,package,conda,update-all | 43,753,833 | 3 | true | 0 | 0 | You can either update them all manually conda update yourpackage
...or you could update them all conda update --all, and then downgrade python again with conda install python=3.5.2. | 2 | 4 | 0 | I am a beginner in python and I am using an older version of anaconda which has the 3.5.2 version of python, because I would like to use tensorflow with it. I have some outdated packages that I would like to update with "conda update all". Is there a way to do this without updating python from 3.5 to 3.6, which is inco... | Conda update packages except python | 1.2 | 0 | 0 | 3,122 |
43,754,488 | 2017-05-03T08:05:00.000 | 1 | 0 | 1 | 1 | python,windows,python-2.7 | 43,754,997 | 1 | false | 0 | 0 | I don't believe you can show the information in Windows scheduler because it calls ShellExecuteEx() to run your program and that will report success no matter what return code your Python program issues. That is because the scheduler has successfully run the Python interpreter, which is all it cares about.
Have your pr... | 1 | 0 | 0 | I have a python script. I have scheduled it to run monthly on Windows scheduler. However, it is prone to error sometimes and I would like to know if it threw an error. However the windows scheduler always shows the status as Successful. How can I make the Windows scheduler display the error or notify me if my .py scrip... | Throw error on task scheduler when python script throws error | 0.197375 | 0 | 0 | 1,414 |
43,756,353 | 2017-05-03T09:37:00.000 | 1 | 0 | 0 | 0 | python,django | 43,756,404 | 3 | false | 1 | 0 | Try using CharField with unique=True and primary_key=True | 1 | 3 | 0 | I'm learning Django but the ORM doesn't give a way to have a text primary key.I would like to have a primary such as 00RTTIN223.Is there any other way to bypass that limite? | How to use text type as primary key in Django | 0.066568 | 0 | 0 | 6,788 |
43,762,037 | 2017-05-03T13:51:00.000 | 0 | 0 | 0 | 0 | python,h2o | 43,764,060 | 3 | false | 0 | 0 | This has been resolved. It was a path mixup which I have fixed and now can see the same h2o.version from the cmd and jupyter. | 1 | 1 | 0 | I have just run an upgrade on the h2o package in python, but am only getting a version of 3.10.4.1. However, my recently upgraded h2o application is running 3.10.4.6 - can you please help me rectify this discrepancy? Thanks in advance. | Can not connect python to h2o instance (version mismatch) | 0 | 0 | 0 | 466 |
43,767,289 | 2017-05-03T18:14:00.000 | 0 | 0 | 1 | 1 | windows,python-3.x,tesseract | 63,111,594 | 8 | false | 0 | 0 | After adding tesseract to PATH, make sure you restart your PC.
It only worked after the restart. | 6 | 8 | 0 | I'm trying to add tesseract to be able to install pytesseract.
I use Windows 7.
I add this path to my PATH environmental variable
C:\Program Files (x86)\Tesseract-OCR\tesseract.exe
From the command line if I run
tesseract DMTX_screenshot.png out
OR
tesseract
I'm getting
tesseract is not recognized as an int... | Can't seem to run tesseract from command line despite adding PATH | 0 | 0 | 0 | 33,027 |
43,767,289 | 2017-05-03T18:14:00.000 | 1 | 0 | 1 | 1 | windows,python-3.x,tesseract | 63,407,480 | 8 | false | 0 | 0 | I was also having this problem initially. Don't install tesseract via pip install tesseract.
Go to https://github.com/UB-Mannheim/tesseract/wiki and then download latest version for your computer and install that.
Then type sysdm.cpl and add the directory where tesseract.exe is present to env. variables.
for eg: C:\Pro... | 6 | 8 | 0 | I'm trying to add tesseract to be able to install pytesseract.
I use Windows 7.
I add this path to my PATH environmental variable
C:\Program Files (x86)\Tesseract-OCR\tesseract.exe
From the command line if I run
tesseract DMTX_screenshot.png out
OR
tesseract
I'm getting
tesseract is not recognized as an int... | Can't seem to run tesseract from command line despite adding PATH | 0.024995 | 0 | 0 | 33,027 |
43,767,289 | 2017-05-03T18:14:00.000 | 2 | 0 | 1 | 1 | windows,python-3.x,tesseract | 53,088,350 | 8 | false | 0 | 0 | Just add the folder to the Path under Windows (not sure with Win7):
Control Panel > System and Security > System >
Advanced system settings > Advanced > Environment variables > PATH > New | 6 | 8 | 0 | I'm trying to add tesseract to be able to install pytesseract.
I use Windows 7.
I add this path to my PATH environmental variable
C:\Program Files (x86)\Tesseract-OCR\tesseract.exe
From the command line if I run
tesseract DMTX_screenshot.png out
OR
tesseract
I'm getting
tesseract is not recognized as an int... | Can't seem to run tesseract from command line despite adding PATH | 0.049958 | 0 | 0 | 33,027 |
43,767,289 | 2017-05-03T18:14:00.000 | 0 | 0 | 1 | 1 | windows,python-3.x,tesseract | 55,997,371 | 8 | false | 0 | 0 | Add C:\msys64\mingw32\bin to PATH variable in case you've installed it using pacman or msys2. | 6 | 8 | 0 | I'm trying to add tesseract to be able to install pytesseract.
I use Windows 7.
I add this path to my PATH environmental variable
C:\Program Files (x86)\Tesseract-OCR\tesseract.exe
From the command line if I run
tesseract DMTX_screenshot.png out
OR
tesseract
I'm getting
tesseract is not recognized as an int... | Can't seem to run tesseract from command line despite adding PATH | 0 | 0 | 0 | 33,027 |
43,767,289 | 2017-05-03T18:14:00.000 | -1 | 0 | 1 | 1 | windows,python-3.x,tesseract | 55,989,015 | 8 | false | 0 | 0 | Go to the location where you have installed Tesseract-OCR on the terminal and then type tesseract -v. This worked for me. | 6 | 8 | 0 | I'm trying to add tesseract to be able to install pytesseract.
I use Windows 7.
I add this path to my PATH environmental variable
C:\Program Files (x86)\Tesseract-OCR\tesseract.exe
From the command line if I run
tesseract DMTX_screenshot.png out
OR
tesseract
I'm getting
tesseract is not recognized as an int... | Can't seem to run tesseract from command line despite adding PATH | -0.024995 | 0 | 0 | 33,027 |
43,767,289 | 2017-05-03T18:14:00.000 | 10 | 0 | 1 | 1 | windows,python-3.x,tesseract | 43,785,789 | 8 | false | 0 | 0 | The PATH variable should include directories only, not files, such as C:\Program Files (x86)\Tesseract-OCR. | 6 | 8 | 0 | I'm trying to add tesseract to be able to install pytesseract.
I use Windows 7.
I add this path to my PATH environmental variable
C:\Program Files (x86)\Tesseract-OCR\tesseract.exe
From the command line if I run
tesseract DMTX_screenshot.png out
OR
tesseract
I'm getting
tesseract is not recognized as an int... | Can't seem to run tesseract from command line despite adding PATH | 1 | 0 | 0 | 33,027 |
43,768,290 | 2017-05-03T19:18:00.000 | 1 | 1 | 1 | 0 | python,python-2.7,amazon-web-services,aws-lambda | 43,768,891 | 3 | false | 0 | 0 | Try to use a S3 bucket to store the file and read it from the AWS Lambda function, you should ensure the AWS Lambda role has access to the S3 bucket. | 1 | 12 | 0 | Lambda functions have access to disk space in their own /tmp directories. My question is, where can I visually view the /tmp directory?
I’m attempting to download the files into the /tmp directory to read them, and write a new file to it as well. I actually want see the files I’m working with are getting stored proper... | Python/AWS Lambda Function: How to view /tmp storage? | 0.066568 | 0 | 0 | 26,323 |
43,769,071 | 2017-05-03T20:06:00.000 | 0 | 0 | 0 | 0 | python,pickle | 44,855,960 | 1 | false | 0 | 0 | It is more likely to be a pickle file created with python 3. I guess you mainly use python 2.7. Either you re-create the pickle file with python 2.7 or you use python 3. | 1 | 0 | 1 | I have used:
pickle.dump(data, f, protocol=2)
And try to open the pickle file with python 2.7, however, it still pop up with the error "ValueError: unsupported pickle protocol: 3". | ValueError: unsupported pickle protocol: 3, python 2.7 cannot load pickle file even dump with protocol = 2 | 0 | 0 | 0 | 2,769 |
43,769,357 | 2017-05-03T20:24:00.000 | 0 | 0 | 0 | 0 | python,deep-learning,classification,keras,conv-neural-network | 57,201,952 | 1 | false | 0 | 0 | Your method is not impossible, but it is impractical. A Neural Network learns from the training dataset. If you give the same data again in the test set, it will generate accurate predictions, which will have no relation with the network's predictive power. | 1 | 2 | 1 | I am trying to use Keras in Python for time series classification.
I have made a simple CNN and was wondering if it is possible to randomly select a subsection of the full data set at each epoch to serve as the test set?
I am quite new to neural nets so if there are any reasons this is impossible or impractical I woul... | Selecting test and train sets in Keras for Python | 0 | 0 | 0 | 95 |
43,772,362 | 2017-05-04T01:22:00.000 | 7 | 0 | 0 | 0 | python,python-3.x,pandas,indexing | 43,772,528 | 5 | false | 0 | 0 | Sounds like you're calling df.plot(). That error indicates that you're trying to plot a frame that has no numeric data. The data types shouldn't affect what you print().
Use print(df.iloc[159220]) | 1 | 106 | 1 | I have a massive dataframe, and I'm getting the error:
TypeError: ("Empty 'DataFrame': no numeric data to plot", 'occurred at index 159220')
I've already dropped nulls, and checked dtypes for the DataFrame so I have no guess as to why it's failing on that row.
How do I print out just that row (at index 159220) of the d... | How to print a specific row of a pandas DataFrame? | 1 | 0 | 0 | 543,751 |
43,772,536 | 2017-05-04T01:46:00.000 | 8 | 0 | 1 | 0 | python,exception | 43,772,787 | 4 | true | 0 | 0 | Generally, the only times you should be defining your own exceptions are when you have a specific case where raising a custom exception would be more appropriate than raising a existing Python exception.
For example, say I was implementing a command line argument parsing API, and I needed to account for the case where ... | 2 | 3 | 0 | Do you implement your own exception class in python ?
For now, I haven't encountered the situation I get in trouble
without original ones. I mean, built-in Exception is enough.
What would be the main benefit of self-implemented Exception ? | Do you implement your own Exception in Python? | 1.2 | 0 | 0 | 2,382 |
43,772,536 | 2017-05-04T01:46:00.000 | 3 | 0 | 1 | 0 | python,exception | 43,772,654 | 4 | false | 0 | 0 | It's useful if you want to catch a specific kind of exception that you make. You never want to catch just "Exception," because you might be catching some other exception that you don't know about. | 2 | 3 | 0 | Do you implement your own exception class in python ?
For now, I haven't encountered the situation I get in trouble
without original ones. I mean, built-in Exception is enough.
What would be the main benefit of self-implemented Exception ? | Do you implement your own Exception in Python? | 0.148885 | 0 | 0 | 2,382 |
43,775,108 | 2017-05-04T06:09:00.000 | 2 | 0 | 1 | 0 | python,arrays,list,dictionary,store | 43,775,529 | 3 | false | 0 | 0 | Here are a couple of ways of doing this:
As Geotop suggested, use a dictionary indexed with a tuple.
This according to me is an elegant solution.
Depending on the purpose and ease of traverse, you may convert the same to a nested list as follows:
a = [ [ (1,2), (3,4), (5,6) ],
[ [123,234,345], [567,678,543],... | 1 | 1 | 1 | I will write an example so you can understand me :
For instance, I have these 3 points : (0, 1, 244) - (0, 1, 255) - (1, 2, 133)
Actually I need to average the Z when 2 points have the same (x, y). My idea is to store them in something (an array, a dictionary ?) with a double index/key where the value is an array of th... | Store points by x, y and multiple z | 0.132549 | 0 | 0 | 85 |
43,775,551 | 2017-05-04T06:37:00.000 | 0 | 0 | 1 | 0 | python,windows,python-3.x | 43,777,375 | 2 | false | 0 | 0 | You can, of course, use the Win32 Jobs API (CreateJobObject & AssignProcessToJobObject) to spawn your program as a sub-process and manage its resources.
But I guess a simpler solution, without going through all the hassle of coding, is to use Docker to create a managed environment. | 1 | 3 | 0 | I write deep learning software using Python and the Tensorflow library under Windows. Sometimes by mistake I load too much into memory and the computer stops responding; i cannot even kill the process.
Is it possible to limit the memory and CPU usage for Python scripts under Windows? I use PyCharm as an editor. Under U... | How to limit memory and CPU usage in Python under Windows? | 0 | 0 | 0 | 3,497 |
43,776,128 | 2017-05-04T07:07:00.000 | 3 | 0 | 1 | 0 | python,python-3.x,range,python-3.5 | 43,776,191 | 5 | false | 0 | 0 | range(a, b) return an instance of class range. You can check it by print(type(range(1, 5))).
And what you expect can be got by print(list(range(a, b))). | 2 | 10 | 0 | I thought that the range() function returns a list with the arguments that you have put inside the parentheses. But when I type range(4) in IDLE, I get range(0, 4) as output. Similarly, when I type print(range(4)), I also get range(0, 4) as output. I am currently using python 3.5.
I am currently studying python with th... | What is the return value of the range() function in python? | 0.119427 | 0 | 0 | 25,369 |
43,776,128 | 2017-05-04T07:07:00.000 | 4 | 0 | 1 | 0 | python,python-3.x,range,python-3.5 | 50,551,871 | 5 | false | 0 | 0 | print(range(10)) returns range(0, 10) as output
In many ways the object returned by range() behaves as if it is a list, but in fact it isn’t. It is an object which returns the successive items of the desired sequence when you iterate over it, but it doesn’t really make the list, thus saving space.
We say such an object... | 2 | 10 | 0 | I thought that the range() function returns a list with the arguments that you have put inside the parentheses. But when I type range(4) in IDLE, I get range(0, 4) as output. Similarly, when I type print(range(4)), I also get range(0, 4) as output. I am currently using python 3.5.
I am currently studying python with th... | What is the return value of the range() function in python? | 0.158649 | 0 | 0 | 25,369 |
43,777,243 | 2017-05-04T08:06:00.000 | 2 | 0 | 0 | 0 | python-3.x,pandas | 68,590,093 | 3 | false | 0 | 0 | Creating a dataframe with 70% values of original dataframe
part_1 = df.sample(frac = 0.7)
Creating dataframe with rest of the 30% values
part_2 = df.drop(part_1.index) | 1 | 14 | 1 | I have a pandas dataframe sorted by a number of columns. Now I'd like to split the dataframe in predefined percentages, so as to extract and name a few segments.
For example, I want to take the first 20% of rows to create the first segment, then the next 30% for the second segment and leave the remaining 50% to the th... | How to split a DataFrame in pandas in predefined percentages? | 0.132549 | 0 | 0 | 22,451 |
43,777,551 | 2017-05-04T08:22:00.000 | 0 | 0 | 1 | 0 | python,python-2.7,eval | 50,250,547 | 2 | false | 0 | 0 | If Jean_Francois' solution still isn't fast enough, you can take a look at numba. f_numba = jit(f), and then probably also @jit the function that calls f_numba so that f_numba is inlined into the caller. Depends on your application. | 1 | 6 | 0 | Say I have a function fun(f, x, y) where x and y are numbers and f is a string specifying a function such as "1 / x ** 2 + y".
I wish to use this function f a lot, say a few million times, and the values of x and y change between each use.
Therefore calling eval(f) takes a significant amount of time as opposed to just ... | Python saving an eval function | 0 | 0 | 0 | 505 |
43,779,636 | 2017-05-04T09:56:00.000 | 1 | 1 | 1 | 0 | python,linux,unix,raspberry-pi,startup | 54,028,966 | 2 | true | 0 | 0 | I'm answering my own question with a better method for running scripts at boot/startup.
I'm not exactly sure why this was happening, but I did learn that executing scripts on startup with this method is a bad practice and is best avoided.
I started using the Crontab instead.
This is what you need to do:
crontab -e
Th... | 1 | 4 | 0 | Why is my Python script running twice in the background when I try to execute it at startup of my Raspberry Pi by adding the command to /etc/profile?
I have a command written at the end of the file /etc/profile for a Python script to run at startup of my Raspberry Pi, "sudo python /path/filename.py &", and for some rea... | Why is my Python script running twice in the background when I try to execute it at startup of my Raspberry Pi by adding the command to /etc/profile? | 1.2 | 0 | 0 | 1,752 |
43,779,887 | 2017-05-04T10:07:00.000 | 0 | 0 | 1 | 0 | python,excel,openpyxl | 43,783,883 | 1 | false | 0 | 0 | Sounds like you might want to take advantage of the type guessing in openpyxl. If so, open the workbook with guess_types=True and see if that helps. NB. this feature is more suited to working with text sources like CSV and is likely to be removed in future releases. | 1 | 0 | 0 | I process a report that consists of date fields. There are some instances wherein the date seen in the cell is not a number (how do I know? I use the isnumber() function from excel to check if a date value is really a number).
Using a recorded macro, for all the date columns, I do the text to columns function in excel ... | How to convert date formatted as string to a number in excel using openpyxl | 0 | 1 | 0 | 940 |
43,780,726 | 2017-05-04T10:46:00.000 | 1 | 0 | 0 | 1 | python,virtualenv | 43,782,062 | 2 | false | 0 | 0 | Instead of trying to "simulate" some non-existant path, just avoid hardcoding any path in your app and you will be fine.
Hint: environment variables and/or command-line arguments are canonical ways to avoid harcoding environment-dependant values. You can read environment variables from the os.environ mapping.
This be... | 1 | 0 | 0 | I'm developing a python application over Windows. However, this application will be deployed in Linux systems.
This application will have a configuration file at /etc/myapp/config. This path is not possible in Windows.
So, my question is:
In Python, is there any way to simulate, only during development process, the ex... | Simulate directory existence during development | 0.099668 | 0 | 0 | 50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.