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 database on let's say a server and allow my script to access them remotely (my script could edit the database from my school computer)? By the way, I'm using python 3.X EDIT i made a database api that runs in python 3, its called TaliffDb to install type pip3 install TaliffDB in your terminal. im working on a documentation, but please do comment if you have any questions
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. ii. and you simply want to find them: Then you should use a Matcher to find them efficiently after you've created the Doc. Then you can do what you want with the spans that you find. Make them pronouns if you want. You don't have a complete list of the medicines/drugs of interest... i. but you want to generally identify them: Then you'll need to train an NER model to recognize them. To generate the training data you could take a whole bunch of papers and use a Matcher looking for known medicines/drugs to grab a whole bunch of example sentences. Then you train... Later edit: To be clear, the Vocab only stores strings and assigns them a unique ID for working with under the hood. It's the Tagger which decides whether it's a PRON or not.
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 spacy NER? Thanks
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 any way to download the modifications to the database during production so that I can keep these changes when I redeploy. I'm not using AWS RDS, I simply bundle the .SQLite file with my source code and deploy to Elastic Beanstalk. Thanks in Advance.
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 activate it?
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            /__init__.py            /helpers.py In the /dh/__init__.py file I have three import statements as follows from Crypto.Hash import SHA256 -> it is fine from Crypto.Random import random -> gives me error "from Crypto.Random import OSRNG ImportError: cannot import name 'OSRNG' " from lib.helpers import read_hex --> gives me error "from lib.helpers import read_hex ImportError: No module named 'lib' " I found out that there is not such file or folder OSRNG in Python34/Lib/sit-packages/Crypto/Random/ How can I fix these two errors? Thanks guys
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 understand plugins have the ability to set the screensaver. in other words, make a plug in that sends and receives message to and from the pi. this is not really an answer because im not familiar with creating Kodi plugins, but I know it's possible because there are other plugins that do it...
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 light sensor. For the moment, I develop in Python2.7 but the issue can use another language or by shell. Thank you very much!
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 between Year and Month in Y0M column, (only for single digit numbers and not double digit) Currently I am able to only do this by converting to string, but I want to retain them as type numbers
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: [Errno 2] No such file or directory: '/home/plagtag/anaconda/envs/p34/bin/python Because it should look it up in /home/plagtag/anaconda/envs/p36/bin/python Where can i update the kernels jupyter uses? grep -rn p34 $HOME/.jupyter gives no result at all :-/
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 they are used in is run. Putting them in modules also encourages their reuse since they're no longer mixed in with a lot of other unrelated stuff. Lastly, they may be useful because modules are esstentially singleton objects, meaning that there's only once instance of them in your program which is created the first time it's imported. Later imports in other modules will just reuse the existing instance. This can be a nice way to do initialize that only has to be done once.
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 functional reason or is it solely for readability? I can perform all the same task using defined functions within my main module so what is the need for the class if any outside of readability?
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 project's root is of course the obvious place for your own project-specific apps. Third-parts are usually installed as python packages (Django apps are python packages) in your virtualenv.
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 apps? Why is it that this is being recommended in the first place? What is the advantage of having the apps available to be imported as its own top-level module rather than a submodule of mysite?
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, however by manually testing I discovered that mkl_avx.dll was also necessary for numpy.linalg. By simply copying this to the dist directory this problem was resolved.
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 as soon as it gets to that line. The executable compiles with no errors. Everything runs as it should until it gets to a linalg command, then the executable just closes with no warning or error. No error log gets written. I've confirmed that it's always the linalg commands by manually writing log files with flags around the commands. I've used other scipy packages, primarily optimize, before with no issues. I've tried catching the error with a 'try' statement, but it crashes regardless. I can only think it's some kind of import error, but those normally throw errors when the executable is being built. The complete lack of any error or warning messages has me at a loss as to what could be causing this.
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 value that indicates the unpadded length. If you're not using an RNN (what are you doing with variable length inputs then??) you must be processing them one-by-one (you didn't give us much detail there) so just break them up and send them into the queue one by one, read them off in TF as you need and recombine them with TF slicing and joining operations.
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 can mitigate or eliminate most of these issues. The version you require would be specified by your webapp, and you'd be compelled to install it anyway. The packages you require could be pulled down through the use of a package manager, thus eliminating any manual installation of these. If you don't hook this package to a code repository at all, then there's no fear of intrusion from the outside. Additionally, a package is a lot more consumer-friendly. Sure, we as developers work just fine with setting up code and environments, but if you want to show something off real fast, the last thing you want to do is force someone to have to download all of the dependencies and prerequisites before they can run your app.
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 I would assume that a production server would once it is set up correctly. This is probably an issue of simply not having the right mindset, but I just can't find a reason why I want to do this. Is it for easy replication or something else altogether?
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/destination/for/file.txt") Which method is better to use in order to move the file to the destination folder and delete any duplication files that might occur there? Thanks.
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 even linearly with the overall list length) and it is only their difference n2-n1 which remains small. In this case you need a selection algorithm such as quickselect which will remain O(N) in this case.
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 then retrieve the n1 th number, n1+1 th number until the n2 th number from the sorted array. But since n1 and n2 are usually relatively small compared to the size of the array, it is not necessary to sort the array completely. The algorithm should be able to stop in middle once reaches n2 I think. I wonder if there is any algorithm, maybe a modified version of certian sorting algorithm that is specifacally good (by good I mean fast) at this problem. You can either use Python code or pseudo code as an illustration, thanks!
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 elements and return rest of the elements. Complexity of this step is O(1)+O(logN) Hence, overall we have O(N2 * logN)
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 then retrieve the n1 th number, n1+1 th number until the n2 th number from the sorted array. But since n1 and n2 are usually relatively small compared to the size of the array, it is not necessary to sort the array completely. The algorithm should be able to stop in middle once reaches n2 I think. I wonder if there is any algorithm, maybe a modified version of certian sorting algorithm that is specifacally good (by good I mean fast) at this problem. You can either use Python code or pseudo code as an illustration, thanks!
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 for use on iOS. During the end of 2010 cocos2d-x comes that is written in C++ language.
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 'python' is not recognized as an internal or external command, operable program or batch file. [Finished in 0.083s] I tried to run the same script in the command line, and it said the same thing. I'm new to programming, so please try to be a little patient.
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 'python' is not recognized as an internal or external command, operable program or batch file. [Finished in 0.083s] I tried to run the same script in the command line, and it said the same thing. I'm new to programming, so please try to be a little patient.
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 'python' is not recognized as an internal or external command, operable program or batch file. [Finished in 0.083s] I tried to run the same script in the command line, and it said the same thing. I'm new to programming, so please try to be a little patient.
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 'python' is not recognized as an internal or external command, operable program or batch file. [Finished in 0.083s] I tried to run the same script in the command line, and it said the same thing. I'm new to programming, so please try to be a little patient.
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 the problem is the search path. If that fails, try again with the full path name, such as C:\Users\Austin\Documents\Python\python.exe. Does that move you closer to a solution?
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 'python' is not recognized as an internal or external command, operable program or batch file. [Finished in 0.083s] I tried to run the same script in the command line, and it said the same thing. I'm new to programming, so please try to be a little patient.
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 variable is cmd or ping. try to tap Win+R and type cmd, note how it opens a new Command Line even though you don't really know where cmd.exe is stored on your hard drive? That is because the path C:\Windows\System32 is stored in your PATH variable. So, we know you installed python, but you want to be able to run it without specifying it's path, how can we do that? Simply add it to our environment variables: Use the keyboard shortcut Win+Pause Click on Advanced system settings At the bottom of the window click on Environment Variables... In the System Variables section find the PATH variable Double click it A new window with a text box has opened, go to it's end with the end button Paste the path C:\Users\Austin\Documents\Python at it's end (be sure to add a ; before pasting if there isn't one there. Click ok Open a new cmd window Try and type python you should be all set now, on the command line and in Atom. If it isn't clear, the win button is the button on your keyboard with the windows icon on 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 'python' is not recognized as an internal or external command, operable program or batch file. [Finished in 0.083s] I tried to run the same script in the command line, and it said the same thing. I'm new to programming, so please try to be a little patient.
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 store the data there are many options which could either be a flat file(write to a text file), save as a python binary(use shelf or pickle), or install an actual database like MySQL or PostgreSQL and many more. Google for info. Additionally an ORM like SQLAlchemy may make controlling, querying, and updating your database a little easier since it will handle all tables as objects and create the SQL itself so you don't need to code all queries as strings.
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 phrased/explained - I'm entirely self taught and so have no formal training in computer science. I don't know how to tell a piece of python code to run itself every say n-minutes and I also have no idea how to correctly approach building such a data base or what factors I should be considering. Can someone point me in the right direction for getting started on the above?
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 can make your algorithm independent , then you can do "incremental way of learning" !!
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 means, no matter how fancy I create a script, I have to run the script everytime for each update, this is not enough. I think that machine learning is more than that, and there are already smart systems that are constantly updating their systems automatically, and I am really interested in that, but can't really find any good materials that dive deep into that field. Let's just say, like the classic example, there's a website that has a ML system at the backend that identifies iris categories, and it's visitors constantly upload new observations of irises and the visitors get the category of the iris they upload, and the backend system continues to improve accordingly. How can I get to learn thing like this? Would be super keen to dive into this field. I'd really appreciate all your opinions! Thanks a lot!
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 end, it is the weighted sum of all leaves. This is in case of binary classification and regression.
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 of trees will be combined like w1*h1+w2h2+...+wn*hn, in which wi is weigh and hi is the answer of ith tree in boosting). Actually, I need to have access to weights and inner trees. I'm doing classification. My other question is that, when I use "from xgboost import plot_tree", I receive this error "the package does not have this function". How can I plot my trees? Thanks
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. Since it is not possible for a web application to access client machine, is it possible to create a client application using library like Pywebview which will allow to call that library directly from the web application using Javascript.
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 Elasticsearch was a good choice: If you plan to build some kind of search engine later on, Elasticsearch was a good choice (as the name indicates). But you should have a close look at the configuration of Elasticsearch's indexing options etc to make sure it works the way you need it. If on the other hand you just want to store the data and do processing tasks on it later, Elasticsearch was a poor choice and you would be better off with Cassandra or another NoSQL database. Which NoSQL database suits your needs best, depends - again - on the actual usage scenario.
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 equivalent of the Elasticsearch bulk and it affects the performances of my spider. I am interested in performance, and was wondering if Elasticsearch was a good choice, and if maybe there was a more appropriate NoSQL database.
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 but not in Chrome? Thanks!
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 suggest that you define functions for your most reused code bits and gather them in a library (filexy.py) that you import in your notebook. Use the notebook as a short, clean, "working-desk" and your filexy.py library as the "toolbox". That way you can also solve: 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.
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 be nice to be able to import Python files into a Notebook. Is it possible?
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 list is large. Is there any better way to do it? If you are not familiar with the Chinese name, you can tell how you will distinct the English names from some other names, like French names, Italian names, etc.
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 default (in order to run python script in the Atom Editor or the cmd), I have to reinstall v2.7 and ticked the "Add to PATH" option. How can I set my new default python version to use for example in a text editor or cmd... without having to reinstall it?
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 default (in order to run python script in the Atom Editor or the cmd), I have to reinstall v2.7 and ticked the "Add to PATH" option. How can I set my new default python version to use for example in a text editor or cmd... without having to reinstall it?
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 (not the file) in multiple threads. The second problem is that you return a value from the counter, but there is no place for the returned value to go. There's no caller. There's no such concept as "returning" a value from one thread to another. Instead the thread must store the value somewhere, and code in the main thread can then access it. A quick-and-dirty solution is to create a list and pass each thread an index. When it's finished, it uses the index to stuff the result in the list. The third problem is that you have to wait for the threads to finish. Threads have a .join() function for this purpose. Only after all the threads are done can you print a sum of all the counts. This may be a useful learning exercise for you but it will surely be slower than doing the whole thing in one thread. Threads are valuable when you have to wait for some event to occur, and you want to make progress on some other task in the meantime. For simple number crunching there's no advantage to threads (there is for multiprocessing).
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 by having users ("clients") call an API (eg in AWS API Gateway) which will trigger your own code on either AWS Lambda or an application. The Lambda function or app then verifies whether to allow the action and then makes the API call on behalf of the client. This method has other advantages, such as adding functionality to the call, tracking per-user usage for billing purposes and further restricting functionality.
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 read x amount of strings so it is important I be able to limit polly requests per user. Thank you.
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 iterator. Is there a Python package that can analyze a list of integers and return an "optimized" iterator? Or methodologies I can look into to accomplish this?
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): import crazyhackthing.graphicinterface return graphicinterface.GraphicInterface import sys sys.modules["crazyhackthing"] = sys.modules["interfaces"] sys.modules["interfaces"] = CrazyHack() This makes any import statements from this package refer to properties of the object defined there, and thus delay the initialization of files until explicit import. No idea if this works on python 3, and it's probably an awful idea in the first place, but it works for me. May God have mercy on my soul.
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 it's needed later. More info: I have a package of interfaces in my program. They're just parent objects with methods and attributes common to many objects in my program. They have no logical connection other than having similar purposes. They're in a package solely for my convenience; I don't want tons of .py files in the top level, and would rather sort them into subfolders. The package looks like this: interfaces __init__.py destroyinterface.py graphicsinterface.py And the __ init __.py looks like this: from destroyinterface import DestroyInterface from graphicsinterface import GraphicsInterface I want to import DestroyInterface WITHOUT graphicsinterface.py being initialized. graphicsinterface.py imports the driver that's dependent on DestroyInterface, but I can't seem to access DestroyInterface to create the driver without graphicsinterface.py being initialized. I don't want to remove the GraphicsInterface import from the __ init __.py because I don't want things to have to know it lives in a file called graphicsinterface.py when they import it. Including information about the structure of my packages to every single import both adds boilerplate and makes refactoring harder. I want the classes to be accessible for import directly from the interfaces module but their .py files only be initialized if I explicitly access them. I don't want to use a lazy import of the driver in graphicsinterface.py either, both because it's messy (I only want the file being initialized when I actually need it) and because an import inside the time-sensitive methods of GraphicsInterface would slow them down. Am I out of luck? Will I have to sort my files in a different way?
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 Windows App, but I don't know how to do this as I don't know what I need to start to do so, and I also do not know where these files are located. Anyone can help?
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 primitive will be safe Implementation whose __anext__ uses internal state should be safe, but order of the results will undefined Implementation that modifies shared state will be unsafe
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 the same time?
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 manager and the with statement.
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("started") However as suggested, subprocess is not a very good and safe practice. This solution is easy to realize but I will try to convert the back-end to worker mode by using Celery or django-channels as @Grimmy suggested.
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 make extra ajax call every 0.5 second to update the CPU and Memory status to the front-end. But I find the server is not respond to the extra ajax call until the compute() finishes. After search around, I think I might use the idea of asynchronous or multithreading so I make the function in views.py like below. def submit(request): #some prepare ........ # call the engine t = Thread(target = compute) t.start() return HttpResponse("started") But the system still not response to my extra ajax call until the compute() finish (The "engine" only use around 20% of the CPU, so there is plenty of computing power left). I am a newbie in back-end programming, I am not sure about how Django or backend server handle request internally. Thank you so much if anyone can give me some hint about how to handle this situation.
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 done in some format on disk or in a database (this would be the work queue). Then the worker process will run in a loop checking for available work every N seconds. Increase the number of workers/processes to add more computing power (limited by your hardware of course) The http request that creates the work request can return a job_id the user can query to get the status of the job. Is the job pending/in progress/done? Then maybe the user can also fetch the result of the job or even metadata such as duration and logs? There are also frameworks out there to solve problems like this such as Celery and django-channels. Celery is probably easier to start with, but it might be overkill for what you are trying to do. The advantage of using workers like this is that you can have a very light weight REST api in the front and you can scale up the number of workers, possibly across multiple servers as the demand increases.
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 make extra ajax call every 0.5 second to update the CPU and Memory status to the front-end. But I find the server is not respond to the extra ajax call until the compute() finishes. After search around, I think I might use the idea of asynchronous or multithreading so I make the function in views.py like below. def submit(request): #some prepare ........ # call the engine t = Thread(target = compute) t.start() return HttpResponse("started") But the system still not response to my extra ajax call until the compute() finish (The "engine" only use around 20% of the CPU, so there is plenty of computing power left). I am a newbie in back-end programming, I am not sure about how Django or backend server handle request internally. Thank you so much if anyone can give me some hint about how to handle this situation.
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.py but it says the package is not found. Is there perhaps a zip file of the random module that I can install?
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.py but it says the package is not found. Is there perhaps a zip file of the random module that I can install?
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 of ProcMon to figure out whether python.exe is just a stub, but before I expend that much effort, I thought that I would inquire here. Please be forewarned that I'll be posting this same question, under exactly the same title, on The Code Project, on the assumption that its audience doesn't completely overlap this one.
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 or deleting files. If you do not trust the user, you have much more work to do. You could program a "function builder", much like the equation editor in Microsoft Word and similar programs. If you "know just the very basic of Python programming" this is beyond you. You might be able to use a search engine to find one for Python. One more possibility is to write your own evaluator. That would also be beyond you, and you also might be able to find one you can use. If you need more detail, show some more work of your own then ask.
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) function and save it as a variable and use that information to give values of that function on different points. I know just the very basic of Python programming and maybe this is pretty easy, but how can I do it?
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 through, iterating views and elements in views, I thought I'd ask if there's a direct command open in the API. Or a way to call the show ribbon command. Thanks in advance
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 based shadow render is much quicker and can be done in real time, the results are limited to the quality of the UV mapped texture. Do you capture the surface material from the single image or do you apply a pre-mapped UV surface material to your standard 50k triangle model mesh?
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 also need something that is fast, because this is potentially going to be part of the pre-processing for the network in real-time (apply the network to live video. The mesh is quite simple, it's a simple face with about 30k vertices and 50k triangles.
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 wonder if there is any easier way to just listen to 2 ports/websockets.
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 wonder if there is any easier way to just listen to 2 ports/websockets.
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 the class definition and note the range of lines. Then grep that module for self.method and delete or ignore hits outside that range. Then grep all modules of interest for import module and from module to find modules that might use the class and method. Then grep groups of modules depending on the specific form of import. As others have pointed out, even this will miss calls that use aliases for the method name. But only you can know if this is an issue for your scenario. It is not, that I know of, for what I have done. An entirely different approach, not depending on names, is to instrument the function with code that logs its calls, after using dynamic introspection to determine the caller. (I believe there are SO Q&As about this.)
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() in source file 1, object2.method_name() in source file 2, ... and objectN.method_name() in source file N). An example could be shown on re module and it's method re.findall. I tried to print the lines with grep, but this is a problem for methods having the same name (e.g. I tried it with method named connect(), but 24 classes have a method named connect... I'd like to filter this for particular class (and/or module).
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 suffer through myself. Enjoy!
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, and the never-ending cascade of problems that comes with that on Windows), but I just cannot seem to find one single relevant Google hit about it?
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 all, just to see if it affects throughput.
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 three replicas. But this time the throughput got reduced to 30 MBps. My question is that shouldn't kafka allow the producer to still get a throughput of 50 MBps even in presence of replicas? There is nothing else running in the system, so I am not sure why this is happening?
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 worded question but this is the best I can explain it.
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 individual day, I'd start trying to query for month blocks, and if this is still too much data, query for each date individually.
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. There are 2 types of data limits: By number of rows in response, and By number of data points required to compute the total, such as summary row." Any way I can do this? And, another question, is there like any way to pull raw data from facebook ad account, like a dump of all the data that resides on facebook for an ad account?
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 process every time that new task is added. I solved it with Dan Baders schedule package. I scheduled task on every minute which checks database for tasks that need to be executed in current minute. Then I start each of this tasks in new thread. Hope this helps.
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 know what. Please suggest how can I achieve this.
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 in one request.
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 for both?
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 wondering if there is a way of saving the socket object to a file? then load it back up when the server restarts? or forcefully keeping a socket open even after the program stops. This way the clients never disconnect at all. Could really do with hot swappable code here really!
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 of logic in templates. Plus its always good to have a dumb client (template). I will prefer the Python approach because of the idea to keep client thin and not because of the performance gap. Plus if tomorrow you need to add one more language then changing templates is always going to be difficult then server.
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 means I should check the value to translate it. What's faster: to check and translate fields in template or to make extra fields and translate strings in the Python script?
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 integration but i am not sure how the script will be triggered on login?
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 install depending on the program I'm using. never had an issue until today. So I have no idea what I updated or what software I installed, but I've been working at this for 8 hours, and I can't figure it out. Python27 launches fine. Here are the errors: Error when launching python 3.6 (32Bit) shell: Fatal Python error: PyInitialize: unable to load the file system codec File "C:\Python27\lib\encodings\init_.py", line 123 raise CodecRegistryError,\ ^ SyntaxError: invalid syntax Current thread 0x00000a00 (most recent call first): Error when launching python 3.6 from a win prompt: c:\python36>python.exe Fatal Python error: PyInitialize: unable to load the file system codec File "C:\Python27\lib\encodings\init_.py", line 123 raise CodecRegistryError,\ ^ SyntaxError: invalid syntax Current thread 0x00004e10 (most recent call first): So why is it calling Python27’s path? I check the executable for the python3.6 launcher, it's target is c:\python36\python.exe - which is exactly where it's at. I’ve checked the PATH in EV for both user and system, and it’s good to go. I've completely ripped out both python2.7 and 3.6 and reinstalled them both but I can't get 3.6 to run. I'm lost HALP!
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 python directory, and just install my program without sudo using --user or virtualenv.
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 virtualenv And getting [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/test-easy-install-27105.write-test' It works good enough with sudo(but there are troubles with uninstall, and it is still not working with virtualenv) Using: Ubuntu 14.04, Python 2.7,
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 incompatible with tensorflow?
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 incompatible with tensorflow?
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 program write the error to the Windows event log and look for it there. You can get fancy and set up the event log to notify you.
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 script throws an error?
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 internal or external command. Here is a copy-paste of the a portion of my environmental variable: C:\Program Files (x86)\Tesseract-OCR\tesseract.exe;C:\Users\Moondra\Anaconda_related\Anaconda\geckodriver.exe; Any ideas as to what I may be doing wrong? Thank you.
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:\Program Files\Tesseract-OCR This solved it 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 internal or external command. Here is a copy-paste of the a portion of my environmental variable: C:\Program Files (x86)\Tesseract-OCR\tesseract.exe;C:\Users\Moondra\Anaconda_related\Anaconda\geckodriver.exe; Any ideas as to what I may be doing wrong? Thank you.
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 internal or external command. Here is a copy-paste of the a portion of my environmental variable: C:\Program Files (x86)\Tesseract-OCR\tesseract.exe;C:\Users\Moondra\Anaconda_related\Anaconda\geckodriver.exe; Any ideas as to what I may be doing wrong? Thank you.
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 internal or external command. Here is a copy-paste of the a portion of my environmental variable: C:\Program Files (x86)\Tesseract-OCR\tesseract.exe;C:\Users\Moondra\Anaconda_related\Anaconda\geckodriver.exe; Any ideas as to what I may be doing wrong? Thank you.
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 internal or external command. Here is a copy-paste of the a portion of my environmental variable: C:\Program Files (x86)\Tesseract-OCR\tesseract.exe;C:\Users\Moondra\Anaconda_related\Anaconda\geckodriver.exe; Any ideas as to what I may be doing wrong? Thank you.
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 internal or external command. Here is a copy-paste of the a portion of my environmental variable: C:\Program Files (x86)\Tesseract-OCR\tesseract.exe;C:\Users\Moondra\Anaconda_related\Anaconda\geckodriver.exe; Any ideas as to what I may be doing wrong? Thank you.
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 properly in /tmp during execution. Thank you
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 would appreciate clarity.
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 data frame? Thanks
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 a user enters an invalid command line argument, whatever it may be. Now I could simply raise a Python exception like SyntaxError or a NameError, but that would be a bad design decision. I want to be able to convey to the user why an exception is being raised, not just that an exception is being raised. A better option would be to subclass the general exception class Exception, and create a specific, custom exception. Perhaps InvalidCommandLineArgument. Now instead of having to use a general Python exception, I can use my custom exception which helps to clearly and concisely inform the user of their error. This can also be useful if you want to be informed when a certain action fails in your code. For instance, if you create a function to download a certian file from the internet, it can raise a NoInternetConnection exception to inform you when the is internet connection is down. This allows you to take a certain action based upon that exception being raised. Now you may wondering why in the second case you couldn't simply use a conditional statement to test if there was an internet connection before trying to use it. The reason you'd choose the later versus the former is because of the motto in Python that "asking for forgiveness is easier than asking for permission." This basically means that it's easier to ask Python to catch an exception if one is thrown, than to try to tiptoe around all possible errors using conditional statements. In the end, its not about "Do you implement your own Exceptions in Python?", but "When do you implement your own Exceptions in Python?"
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], [433,645,754] ] ] Now you may access the list of z values corresponding to (x,y) using a[1][i], where the tuple (x,y) is stored as a[0][i]. The second method seems much better to me as it avoids dictionary use and makes indexing much easier (as it is indexed with integers.). But at the end, it all depends on your purpose. Storing it randomly in a list and getting the values by a search is a bad idea if you look up the data frequently or if the data is huge.
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 the Z. So I basically want to have this : [0, 1, [244, 255]] and [1, 2, [133]] My problem is I don't know what to use to store them the simpliest way to do so... Thanks in advance !
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 UNIX Systems there seems to be the possibility to use resource.RLIMIT_VMEM, but under Windows I get the notification no module named resource.
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 the following eBook: "How To Think Like a Computer Scientist" and in that eBook, they provide active code blocks where you can run python code. And when I run print(range(4)) in there, I do get the list that I expected, i.e. [0, 1, 2, 3]. Can someone explain this to me? Thanks in advance!
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 is iterable, that is, suitable as a target for functions and constructs that expect something from which they can obtain successive items until the supply is exhausted. We have seen that the for statement is such an iterator. The function list() is another; it creates lists from iterables: list(range(5)) returns [0, 1, 2, 3, 4] as output
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 the following eBook: "How To Think Like a Computer Scientist" and in that eBook, they provide active code blocks where you can run python code. And when I run print(range(4)) in there, I do get the list that I expected, i.e. [0, 1, 2, 3]. Can someone explain this to me? Thanks in advance!
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 third segment. How would I achieve that?
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 calculating the value of the function each time. (About 50x, in my measured case.) Is there any way to save this function f so that I would only have to call eval once? PS. Please do not discuss the (un)safety of using eval here, I am aware of it, but this code isn't going anywhere where a 3rd party will run it, nor is it relevant to my question.
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 This opens up the crontab, then add the following line: @reboot python /filelocation/filename.py This will execute the script as soon as the Pi boots up. No more double script runs!
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 reason it runs twice, every time. When I comment the line out and execute it manually from the command line it runs normally. Why does that happen and what can I do to prevent that from happening? I know for fact that it is running twice in the background because in my code I have a buzzer that beeps twice at times and 3 times at others, and it beeps 4 times instead of 2 and 6 times instead of 3. Also the code ends up contradicting itself, clearly because each script run is trying to do something else at the same time. Thanks in advance.
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 to make these dates pass the isnumber() validation. And then I continue further processing using my python sccipt. But now I need to replicate the text to column action in excel, and imitate this in Python openpyxl. I naively tried to do the int(cell.value) but this didn't worked. So to sum up the questions, is there a way in Python to convert a date represented as text, to be changed to a date represented as a number?
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 being said, if your app is going to be deployed on some linux distro, you should REALLY test it on the same distro to make sure there are no other glitches. It's not a valid reason for hardcoding your config path (even native linux apps don't and rely on either env variable and/or command line args), but there are quite a few other differences between a unix-like and windows...
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 existence of a certain directory and file (such as /etc/myapp/config)? Thank you.
Simulate directory existence during development
0.099668
0
0
50