Title
stringlengths 15
150
| A_Id
int64 2.98k
72.4M
| Users Score
int64 -17
470
| Q_Score
int64 0
5.69k
| ViewCount
int64 18
4.06M
| Database and SQL
int64 0
1
| Tags
stringlengths 6
105
| Answer
stringlengths 11
6.38k
| GUI and Desktop Applications
int64 0
1
| System Administration and DevOps
int64 1
1
| Networking and APIs
int64 0
1
| Other
int64 0
1
| CreationDate
stringlengths 23
23
| AnswerCount
int64 1
64
| Score
float64 -1
1.2
| is_accepted
bool 2
classes | Q_Id
int64 1.85k
44.1M
| Python Basics and Environment
int64 0
1
| Data Science and Machine Learning
int64 0
1
| Web Development
int64 0
1
| Available Count
int64 1
17
| Question
stringlengths 41
29k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Will the file be removed from the current folder? | 43,662,855 | 0 | 0 | 56 | 0 | python | 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 | 0 | 1 | 0 | 0 | 2017-04-27T16:05:00.000 | 3 | 1.2 | true | 43,662,743 | 1 | 0 | 0 | 1 | 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. |
Why can't Python run in Atom? | 69,393,225 | 1 | 4 | 24,120 | 0 | python,atom-editor | 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 ¯\_(ツ)_/¯ | 0 | 1 | 0 | 1 | 2017-04-28T00:10:00.000 | 7 | 0.028564 | false | 43,669,897 | 0 | 0 | 0 | 6 | 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? | 71,393,101 | 0 | 4 | 24,120 | 0 | python,atom-editor | 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. | 0 | 1 | 0 | 1 | 2017-04-28T00:10:00.000 | 7 | 0 | false | 43,669,897 | 0 | 0 | 0 | 6 | 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? | 62,619,959 | 0 | 4 | 24,120 | 0 | python,atom-editor | I solved this issue, by put the good python path in Atom ide-Python
simply i put D:\my_python_folder\Python.exe | 0 | 1 | 0 | 1 | 2017-04-28T00:10:00.000 | 7 | 0 | false | 43,669,897 | 0 | 0 | 0 | 6 | 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? | 46,919,992 | 0 | 4 | 24,120 | 0 | python,atom-editor | 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. | 0 | 1 | 0 | 1 | 2017-04-28T00:10:00.000 | 7 | 0 | false | 43,669,897 | 0 | 0 | 0 | 6 | 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? | 43,669,935 | 0 | 4 | 24,120 | 0 | python,atom-editor | 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? | 0 | 1 | 0 | 1 | 2017-04-28T00:10:00.000 | 7 | 0 | false | 43,669,897 | 0 | 0 | 0 | 6 | 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? | 43,669,978 | 8 | 4 | 24,120 | 0 | python,atom-editor | 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. | 0 | 1 | 0 | 1 | 2017-04-28T00:10:00.000 | 7 | 1.2 | true | 43,669,897 | 0 | 0 | 0 | 6 | 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. |
How can I change default Python version on the cmd in Windows 10 | 44,543,461 | -3 | 4 | 14,145 | 0 | python,windows,python-2.7,python-3.x,path | 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. | 0 | 1 | 0 | 0 | 2017-04-28T23:58:00.000 | 2 | -0.291313 | false | 43,690,386 | 1 | 0 | 0 | 2 | 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 | 43,709,974 | 7 | 4 | 14,145 | 0 | python,windows,python-2.7,python-3.x,path | 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. | 0 | 1 | 0 | 0 | 2017-04-28T23:58:00.000 | 2 | 1 | false | 43,690,386 | 1 | 0 | 0 | 2 | 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 open a Windows 10 app with a python script? | 59,797,481 | 0 | 2 | 11,049 | 0 | python,windows,python-3.x,automation,windows-10 | 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. | 0 | 1 | 0 | 0 | 2017-04-29T14:20:00.000 | 4 | 0 | false | 43,696,735 | 1 | 0 | 0 | 1 | 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? |
Install requests by pip, but it doesn't work | 43,719,629 | 0 | 0 | 150 | 0 | python | You mention trying "pip" while the documentation clearly mentions "pip3". On certain systems there's a difference. | 0 | 1 | 0 | 0 | 2017-05-01T12:53:00.000 | 3 | 0 | false | 43,719,408 | 1 | 0 | 0 | 3 | 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 | 43,719,472 | 1 | 0 | 150 | 0 | python | 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. | 0 | 1 | 0 | 0 | 2017-05-01T12:53:00.000 | 3 | 1.2 | true | 43,719,408 | 1 | 0 | 0 | 3 | 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 | 43,719,495 | 0 | 0 | 150 | 0 | python | Not as far is I know - you'd need to install python which should include pip. | 0 | 1 | 0 | 0 | 2017-05-01T12:53:00.000 | 3 | 0 | false | 43,719,408 | 1 | 0 | 0 | 3 | 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 |
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? | 43,728,509 | 0 | 0 | 193 | 0 | python,windows,python-3.x,autobahn | 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! | 0 | 1 | 0 | 0 | 2017-05-02T00:51:00.000 | 1 | 1.2 | true | 43,728,508 | 1 | 0 | 0 | 1 | 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? |
Can kafka producers supply data at quota rate in presence of replicas? | 43,740,571 | 0 | 0 | 77 | 0 | apache-kafka,kafka-producer-api,kafka-python | 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. | 0 | 1 | 0 | 0 | 2017-05-02T01:21:00.000 | 1 | 0 | false | 43,728,696 | 0 | 0 | 0 | 1 | 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? |
How to dynamically schedule tasks in Django? | 43,733,656 | 2 | 6 | 6,721 | 0 | python,django,celery | 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. | 0 | 1 | 0 | 0 | 2017-05-02T08:29:00.000 | 5 | 0.07983 | false | 43,733,387 | 0 | 0 | 1 | 1 | 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. |
opencv_annotation not recognised by windows | 65,209,790 | 0 | 1 | 743 | 0 | windows,python-2.7,opencv | You need to build it using CMake. | 0 | 1 | 0 | 0 | 2017-05-02T13:51:00.000 | 1 | 0 | false | 43,739,684 | 0 | 1 | 0 | 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/ |
Can't launch python3.6 on windows: "Current thread 0x00004d18" | 43,745,649 | 0 | 3 | 1,954 | 0 | python,python-3.x | Have you tried using virtual environments when working with multiple Python versions? | 0 | 1 | 0 | 0 | 2017-05-02T19:07:00.000 | 1 | 0 | false | 43,745,458 | 1 | 0 | 0 | 1 | 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! |
python setup.py install without sudo | 43,747,532 | 6 | 8 | 5,190 | 0 | python,ubuntu,pip,permission-denied,setup.py | 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. | 0 | 1 | 0 | 0 | 2017-05-02T20:53:00.000 | 2 | 1 | false | 43,747,034 | 1 | 0 | 0 | 1 | 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, |
Throw error on task scheduler when python script throws error | 43,754,997 | 1 | 0 | 1,414 | 0 | python,windows,python-2.7 | 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. | 0 | 1 | 0 | 0 | 2017-05-03T08:05:00.000 | 1 | 0.197375 | false | 43,754,488 | 1 | 0 | 0 | 1 | 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? |
Can't seem to run tesseract from command line despite adding PATH | 63,111,594 | 0 | 8 | 33,027 | 0 | windows,python-3.x,tesseract | After adding tesseract to PATH, make sure you restart your PC.
It only worked after the restart. | 0 | 1 | 0 | 0 | 2017-05-03T18:14:00.000 | 8 | 0 | false | 43,767,289 | 1 | 0 | 0 | 6 | 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 | 63,407,480 | 1 | 8 | 33,027 | 0 | windows,python-3.x,tesseract | 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. | 0 | 1 | 0 | 0 | 2017-05-03T18:14:00.000 | 8 | 0.024995 | false | 43,767,289 | 1 | 0 | 0 | 6 | 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 | 53,088,350 | 2 | 8 | 33,027 | 0 | windows,python-3.x,tesseract | 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 | 0 | 1 | 0 | 0 | 2017-05-03T18:14:00.000 | 8 | 0.049958 | false | 43,767,289 | 1 | 0 | 0 | 6 | 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 | 55,997,371 | 0 | 8 | 33,027 | 0 | windows,python-3.x,tesseract | Add C:\msys64\mingw32\bin to PATH variable in case you've installed it using pacman or msys2. | 0 | 1 | 0 | 0 | 2017-05-03T18:14:00.000 | 8 | 0 | false | 43,767,289 | 1 | 0 | 0 | 6 | 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 | 55,989,015 | -1 | 8 | 33,027 | 0 | windows,python-3.x,tesseract | Go to the location where you have installed Tesseract-OCR on the terminal and then type tesseract -v. This worked for me. | 0 | 1 | 0 | 0 | 2017-05-03T18:14:00.000 | 8 | -0.024995 | false | 43,767,289 | 1 | 0 | 0 | 6 | 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 | 43,785,789 | 10 | 8 | 33,027 | 0 | windows,python-3.x,tesseract | The PATH variable should include directories only, not files, such as C:\Program Files (x86)\Tesseract-OCR. | 0 | 1 | 0 | 0 | 2017-05-03T18:14:00.000 | 8 | 1 | false | 43,767,289 | 1 | 0 | 0 | 6 | 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. |
Simulate directory existence during development | 43,782,062 | 1 | 0 | 50 | 0 | python,virtualenv | 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... | 0 | 1 | 0 | 0 | 2017-05-04T10:46:00.000 | 2 | 0.099668 | false | 43,780,726 | 0 | 0 | 0 | 1 | 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. |
Google analytics .dat file missing, falling back to noauth_local_webserver | 48,089,379 | 1 | 6 | 913 | 0 | python,amazon-web-services,amazon-ec2,oauth-2.0,google-analytics-api | I am not sure why this is happening, But I have a list of steps which might help you.
check if this issue is caused by google analytics API version, google generally deprecates the previous versions of their API.
I am guessing that you are running this code on cron on your EC2 serv, make sure that you include the path to the folder where the .dat file is.
3.check whether you have the latest credentials in the .dat file.
Authentication to the API will happen through the .dat file.
Hope this solves your issue. | 0 | 1 | 0 | 1 | 2017-05-04T15:56:00.000 | 1 | 0.197375 | false | 43,787,699 | 0 | 0 | 0 | 1 | I have an AWS EC2 machine that has been running nightly google analytics scripts to load into a database. It has been working fine up for months until this weekend. I have not made any changes to the code.
These are the two errors that are showing up in my logs:
/venv/lib/python3.5/site-packages/oauth2client/_helpers.py:256: UserWarning: Cannot access analytics.dat: No such file or directory
warnings.warn(_MISSING_FILE_MESSAGE.format(filename))
Failed to start a local webserver listening on either port 8080
or port 8090. Please check your firewall settings and locally
running programs that may be blocking or using those ports.
Falling back to --noauth_local_webserver and continuing with
authorization.
It looks like it is missing my analytics.dat file but I have checked and the file is in the same folder as the script that calls the GA API. I have been searching for hours trying to figure this out but there are very little resources on the above errors for GA.
Does anyone know what might be going on here? Any ideas on how to troubleshoot more? |
unsupported startup parameter geqo when connecting to PostgreSQL with ODBC | 43,872,906 | -1 | 1 | 913 | 1 | python,postgresql,odbc,julia | Config SSL Mode: allow in ODBC Driver postgres, driver version: 9.3.400 | 0 | 1 | 0 | 0 | 2017-05-04T18:08:00.000 | 2 | -0.099668 | false | 43,789,951 | 0 | 0 | 0 | 1 | When attempting to connect to a PostgreSQL database with ODBC I get the following error:
('08P01', '[08P01] [unixODBC]ERROR: Unsupported startup parameter: geqo (210) (SQLDriverConnect)')
I get this with two different ODBC front-ends (pyodbc for Python and ODBC.jl for Julia), so it's clearly coming from the ODBC library itself. Is there a way to stop it from passing this "geqo" parameter?
An example in pyodbc would be very useful.
Thanks. |
Loading local file from client onto dask distributed cluster | 46,379,569 | 1 | 6 | 2,868 | 0 | python,python-3.x,dask | Network solution :
Under Windows only it should works with a shared forlder: dd.read_csv("\\server\shared_dir")
Under Unix/Linux only it should works with HDFS: import hdfs3 and then hdfs.read_csv('/server/data_dir'...)
But if you want to use Windows AND Linux workers at the same time I don't know since dd.read_csv() with UNC does not seem to be supported under Linux (because of the file path '\server\data_dir') and HDFS with hdfs.read_csv is not working under Windows (import hdfs3 failed because the lib libhdfs3.so doesn't exist under Windows)
Does anyone have a Network solution for workers under Windows and Unix ? | 0 | 1 | 0 | 0 | 2017-05-05T04:53:00.000 | 2 | 0.099668 | false | 43,796,774 | 0 | 1 | 0 | 1 | A bit of a beginner question, but I was not able to find a relevant answer on this..
Essentially my data about (7gb) is located on my local machine. I have distributed cluster running on the local network. How can I get this file onto the cluster?
The usual dd.read_csv() or read_parquet() fails, as the workers aren't able to locate the file in their own environments.
Would I need to manually transfer the file to each node in the cluster?
Note: Due to admin restrictions I am limited to SFTP... |
Running gunicorn on Ubuntu in a conda environment | 43,809,861 | 5 | 4 | 3,262 | 0 | python,ubuntu,gunicorn,conda | So, I was right - the problem is entirely related to my own ineptitude. Rather than deleting this question, though, I'm going to answer it myself and leave it here in case any future fledgling developers run into the same problem. The issue, as it turns out, is that I was running gunicorn --bind 0.0.0.0:8000 wsgi:app in the wrong directory. After I cd into the directory containing wsgi.py, gunicorn works just fine. The takeaway: gunicorn must be run from within the directory containing wsgi.py. | 0 | 1 | 0 | 1 | 2017-05-05T16:21:00.000 | 1 | 1.2 | true | 43,809,618 | 0 | 0 | 1 | 1 | I'm trying to deploy a Flask app on an EC2 instance running Ubuntu. I have my WSGI file set up, but I'm having some issues running gunicorn. At first, I installed gunicorn with sudo apt-get install gunicorn. However, it ran with the wrong version of python, and it threw import errors for each of the modules my Flask app uses. I ascertained that this was due to the fact that I use conda as an environment manager, and because installing with apt-get placed gunicorn outside of the purview virtual environment. So, I uninstalled gunicorn (sudo apt-get purge gunicorn) and reinstalled it through conda (conda install gunicorn). Now, when I run gunicorn (gunicorn --bind 0.0.0.0:8000 wsgi:app), I don't get a 50 line traceback. I do, however, get the following error: -bash: /usr/bin/gunicorn: No such file or directory. I tried uninstalling gunicorn and reinstalling with pip, but I still get the same error. I've tried searching Google and StackOverflow for solutions, but all I've discovered is that I should be installing gunicorn within a virtual environment to overcome this error (which, I beleive, I'm already doing). I'm guessing there's an easy fix to this, and that the problem is related to my ineptitude, as opposed to conda or something else. Any suggestions would be much appreciated. Thanks. |
Anaconda 4.3.1 Navigator can't open on macOS Sierra 10.12.4 | 45,470,042 | 0 | 2 | 1,424 | 0 | python,anaconda,macos-sierra | I was able to open the navigator using 'sudo anaconda-navigator' | 0 | 1 | 0 | 0 | 2017-05-06T03:30:00.000 | 2 | 0 | false | 43,816,435 | 1 | 0 | 0 | 1 | Anaconda 4.3.1 can't open on macOS Sierra 10.12.4
Anaconda Navigator crashes upon launching it.
Please, help me to solve this problem
Tips for layman would be appreciated. |
How do I remove a file from a git repository with dulwich? | 46,393,625 | 0 | 0 | 75 | 0 | python,dulwich | You can "stage" a file that no longer exists, which will remove it. Alternatively, there is also a dulwich.porcelain.remove function that provides the equivalent of git rm (i.e. removes the file if it exists and then unversions it). | 0 | 1 | 0 | 0 | 2017-05-06T18:51:00.000 | 1 | 0 | false | 43,824,204 | 1 | 0 | 0 | 1 | With dulwich I can stage a file using repo.stage, but how do I remove a file ?
I am looking for the equivalent of git rm |
A better way to deploy a Debian-python hybrid application | 43,836,429 | 0 | 0 | 52 | 0 | python,docker,deployment,debian,dpkg | A container is an isolated environment, so you have to ship all what will be needed for your program to run.
Your Dockerfile will be based on Debian, so begin with
FROM debian
and will have some
RUN apt-get update \
&& apt-get install -y mysoft mydependency1 mydependency2
and also
RUN pip install xxx
and end with something like
CMD ["python","myapp.py"]
As your Python program does certainly things like
import module1, module2
Those Python modules will need to be installed in your Dockerfile in a RUN directive | 0 | 1 | 0 | 0 | 2017-05-07T19:57:00.000 | 1 | 1.2 | true | 43,836,027 | 0 | 0 | 0 | 1 | I wrote a small application for Debian linux that calls python2.7 to perform almost all of its functions.
The python functions include for example remote database access, so the app will depend on python modules that are not in every linux distribution by default.
The app is packaged in a dpkg file in order to be used on many other machines (with same linux distribution), using dpkg -i MyApp01.
But the python dependencies have to be installed separately in order for the app to work: for example pip install mysql-connector-python-rf
Now I want to use Docker to ship my dependencies with the app and make it work on other machines without having to install them as above.
Can Docker be used to do this?and how?
If no, Is there a better approach to natively bundle the python dependencies in the dpkg file (assuming target machines have similar environment)? |
Connecting to a data stream with Python | 43,836,803 | 0 | 4 | 95 | 0 | python,c++ | Java has a native keyword that allows functions from c++ to be brought into java as methods. Python might have the same feature. | 0 | 1 | 0 | 0 | 2017-05-07T21:12:00.000 | 1 | 1.2 | true | 43,836,766 | 0 | 0 | 0 | 1 | I need to connect to a data stream written in C++ with my current program in Python, any advice or resources on how to connect? |
python randomly opening the command prompt reinstall to get back to work | 43,984,353 | 0 | 0 | 147 | 0 | python,windows,python-2.7,pycharm | i fixed this issue by uninstalling everything related to python from my computer and removing all environment variables as well , reinstalling anaconda after that to its default location fixed the problem . | 0 | 1 | 0 | 0 | 2017-05-09T00:01:00.000 | 1 | 1.2 | true | 43,859,002 | 1 | 0 | 0 | 1 | this has been very frustrating now, like once every 2 days my anaconda just stops working correctly , i am using pycharm as my IDE and everything works fine , suddenly i find my anaconda terminal (command prompt if u will) starting randomly for no obvious reason , if i hit run on pycharm it opens the terminal and doesn't do anything , if i navigate to my .py file location and try to run it through command prompt it simply runs a new command prompt ( the python command prompt ) and does nothing no code is running its awaiting further commands. is this normal ? anyone has a solution to this
i am using windows 7 |
Moving Files as a Transaction in Python? | 43,883,782 | 0 | 0 | 144 | 0 | python,unix | Neither Python nor Unix has the notion of a transaction for actions on multiple files.
For movement with in a disk partition, the mv command will just update the directory entries using the same inodes so the file doesn't actually move (no risk of failure during the move).
For movement across disks, you could be a temporary directory on the target drive, copy all the files, and it it succeed just do a mv as described about, and finally clear the source. This would provide some measure of protection. | 0 | 1 | 0 | 0 | 2017-05-10T01:22:00.000 | 1 | 0 | false | 43,882,170 | 0 | 0 | 0 | 1 | I have a number of files that I want to move from one folder to another. If for any reason movement of one of those files fails, I want none of them moved. Basically, either all of the files should be moved, or none of them. I could write logic that approximates this myself, but before I do, is there a native Python or Unix way to do this? Figured the situation comes up often enough that a solution probably already exists and I just haven't heard of it. |
Counting Records in Azure Table Storage (Year: 2017) | 43,884,796 | 1 | 0 | 1,349 | 0 | python,azure,azure-table-storage | Returning number of entities in the table storage is for sure not available in Azure Table Storage SDK and service. You could make a table scan query to return all entities from your table but if you have millions of these entities the query will probably time out. it is also going to have pretty big perf impact on your table. Alternatively you could try making segmented queries in a loop until you reach the end of the table. | 0 | 1 | 0 | 0 | 2017-05-10T05:42:00.000 | 2 | 1.2 | true | 43,884,375 | 0 | 0 | 0 | 1 | We have a table in Azure Table Storage that is storing a LOT of data in it (IoT stuff). We are attempting a simple migration away from Azure Tables Storage to our own data services.
I'm hoping to get a rough idea of how much data we are migrating exactly.
EG: 2,000,000 records for IoT device #1234.
The problem I am facing is in getting a count of all the records that are present in the table with some constrains (EG: Count all records pertaining to one IoT device #1234 etc etc).
I did some fair amount of research to find posts that say that this count feature is not implemented in the ATS. These posts however, were circa 2010 to 2014.
I'm assumed (hoped) that this feature has been implemented now since it's now 2017 and I'm trying to find docs to it.
I'm using python to interact with out ATS.
Could someone please post the link to the docs here that show how I can get the count of records using python (or even HTTP / rest etc)?
Or if someone knows for sure that this feature is still unavailable, that would help me move on as well and figure another way to go about things!
Thanks in advance! |
Flask gives "error 32 broken pipe" when being requested too often | 43,896,817 | 1 | 3 | 4,808 | 0 | python,flask,server | This error appear because your server is overloaded! Stop and start it! | 0 | 1 | 0 | 0 | 2017-05-10T12:58:00.000 | 5 | 0.039979 | false | 43,893,208 | 0 | 0 | 1 | 1 | I write a very simple flask server. This server response to GET and give back my home.html.
I visit the site on 127.0.0.1:5000
everything is good till now.
However, if I keep pressing "fresh" (Command+R on my computer) a lot of times for a few second, as fast as I can, then, my flask give this error and breaks down.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in bootstrap_inner
self.run()
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 659, in inner
srv.serve_forever()
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 499, in serve_forever
HTTPServer.serve_forever(self)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 238, in serve_forever
self._handle_request_noblock()
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 297, in _handle_request_noblock
self.handle_error(request, client_address)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 655, in __init
self.handle()
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 216, in handle
rv = BaseHTTPRequestHandler.handle(self)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 251, in handle_one_request
return self.run_wsgi()
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 193, in run_wsgi
execute(self.server.app)
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 184, in execute
write(data)
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 152, in write
self.send_header(key, value)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 401, in send_header
self.wfile.write("%s: %s\r\n" % (keyword, value))
IOError: [Errno 32] Broken pipe
I believe this is what happened: When my server was trying to transmit html to my browser, I pressed the refresh and broke the pipe. So my server got confused and then give error.
How to solve this problem? Or this site is not usable as all since anyone who ask constantly for my page can break my webpage down.
Thanks! |
executing the python in another python file with arguments as path | 43,903,621 | 0 | 0 | 44 | 0 | python,windows,python-2.7 | If you really do not want to remove the whitespaces in your folder's name, put backslashes \ before the spaces in the variable z, to espace them. | 0 | 1 | 0 | 0 | 2017-05-10T22:06:00.000 | 2 | 0 | false | 43,903,460 | 1 | 0 | 0 | 1 | I am relatively new to python. I am trying to call a python file "plotting.py" in another file "main.py". To execute the "plotting.py" file the path should also be given as argument.
So in the "main.py" I have executed so
z='Stream 20170424 15_20_25_856'
os.system('python plotting.py '+z)
Where variable z is the name of the folder and this name, in general, contains the whitespaces and when I execute the "main.py" it gives an error. But when I replace the whitespaces in the folder name with _ and change the variable z accordingly and execute the "main.py" it executes without an error. But I cannot change the name of the folder every time. So is there any possibility to execute the code changing the folder name and giving the variable z has mentioned? |
Python: Should I use shutil or subprocess to manipulate files and directories as a better approach? | 48,022,437 | 2 | 3 | 2,641 | 0 | linux,python-2.7,subprocess,shutil | I'll try to complement this after I go home, but just to begin I'll tell an example code I had wrote yesterday.
You can try it yourself though.
I had made 100k copies from an empty file with shutil and with subprocess.call, using the command time to get the execution time.
The result was worse than I expected.
shutil has taken 7 seconds.
subprocess has taken 2 minutes and 30 seconds.
Depending on how you use subprocess, you can allow code injection... by configuration files or user input.
Compatibility issues. Shutil already handle it for you. | 0 | 1 | 0 | 0 | 2017-05-11T03:12:00.000 | 3 | 0.132549 | false | 43,905,907 | 0 | 0 | 0 | 1 | I'm a beginner in Python and from a shell scripting background. I have learned shutil and also subprocess to create files/directories.
My question is, which one is better and recommended way of manage files in my OS(Linux/Windows) ? I read some Python books that discourage the use of OS commands to do so.
I'm comfortable with Linux and mostly work in Linux environments, I have a very high tendency to use rm, mkdir, cp commands to manage files. Are there problems/benefits of using one over the other? |
Emacs fails to run Python code | 43,966,958 | 0 | 0 | 277 | 0 | python,python-3.x,emacs | Refer to @Ehvince's comment. Make sure that pylint, is in fact, installed using the command line. | 0 | 1 | 0 | 1 | 2017-05-13T18:49:00.000 | 2 | 0 | false | 43,956,820 | 0 | 0 | 0 | 2 | I'm using Emacs 24 and elpy to run some Python 3 code. However, after I open a shell with C-U-C-C-C-Z and then run my code with C-U-C-C-C-C, I get the error in my command line:
Cannot open load file: no such file or directory, pylint
This is odd, as I've made no recent changes to Emacs, but it always tends to be finicky about if it wants to run any code. The python shell works fine, so that shouldn't be the issue. Thanks. |
Emacs fails to run Python code | 43,969,466 | 1 | 0 | 277 | 0 | python,python-3.x,emacs | Do you mean that it used to work ? To me this error means that the elisp pylint package was not installed or not "required". Try installing it with M-x package-install (and be sure to have the pypi pylint package installed in the current virtual env too, if you use one inside emacs -this is a current elpy installation shortcoming).
(made an answer of my comment) | 0 | 1 | 0 | 1 | 2017-05-13T18:49:00.000 | 2 | 1.2 | true | 43,956,820 | 0 | 0 | 0 | 2 | I'm using Emacs 24 and elpy to run some Python 3 code. However, after I open a shell with C-U-C-C-C-Z and then run my code with C-U-C-C-C-C, I get the error in my command line:
Cannot open load file: no such file or directory, pylint
This is odd, as I've made no recent changes to Emacs, but it always tends to be finicky about if it wants to run any code. The python shell works fine, so that shouldn't be the issue. Thanks. |
easy_install not working with no error | 43,981,171 | 1 | 1 | 347 | 0 | python,python-3.x,packages,easy-install | easy_install must be used as a command in the command prompt and it cannot be opened as an application. Go to the folder where easy_install is and open command-prompt in that folder. Now perform installation of any libraries using:
>easy_install pandas #example
Or you can set this path in your environment variables and use it instead of using this path to install everytime. | 0 | 1 | 0 | 0 | 2017-05-15T13:01:00.000 | 1 | 1.2 | true | 43,980,261 | 0 | 0 | 0 | 1 | I'm trying to get new packages (request for example) and trying to do it through easy_install, but when I try to open it (both easy_install and easy_install-3.6) all I get is a blank terminal screen popping up for a second and than closing with nothing happening. What's wrong with it and how can I get new packages? |
Python + Linux: How to determine cron job is scheduled? | 43,987,885 | -1 | 0 | 542 | 0 | python,linux,automation,cron,crontab | Try with 10 * * * * yourscript name.Then check if crontab -l is include your script. Then you can check crontab logs. | 0 | 1 | 0 | 1 | 2017-05-15T19:58:00.000 | 2 | -0.099668 | false | 43,987,799 | 0 | 0 | 0 | 1 | Currently, I’ve scheduled a python script on Linux by adding the following: */10 * * * * /file/testscripts/test_script.py to crontab -e.
It did not run after 10 minutes, so I wrote some code to write the current time on there but wasn’t being updated either.
What could be the issue? And how can I determine my python script has been scheduled for a cron job properly?
Thank you in advance and will accept/upvote answer |
How to make bottle server HTTPS python | 44,016,254 | 2 | 8 | 4,247 | 0 | python-3.x,https,cherrypy,bottle | You need to put your WSGI server (not WsgiRef certainly) behind a reverse-proxy with https support. Nginx is the most common choice. | 0 | 1 | 1 | 0 | 2017-05-16T23:18:00.000 | 3 | 0.132549 | false | 44,013,107 | 0 | 0 | 1 | 1 | I'm using Bottle as my webservice. Currently, its running on bottle's default wsgi server and handles HTTP requests. I want to encrypt my webservice and handle HTTPS requests. Can someone suggest a method for this. I tried running on cherrypy server, but the latest version is not supporting the pyOpenSSLAdapter. |
Tensorflow and Pycharm | 44,022,536 | 3 | 1 | 921 | 0 | python,tensorflow,pycharm,cudnn | The solution is:
Run PyCharm from the console.
OR
add the environment variable to the IDE settings: LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH | 0 | 1 | 0 | 0 | 2017-05-17T08:54:00.000 | 1 | 1.2 | true | 44,020,050 | 0 | 1 | 0 | 1 | I have an issues with tensorflow on pycharm.
Whenever I import tensorflow in the linux terminal, it works correctly. However, in PyCharm community 2017.1, it shows:
ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory
Any hint on how to tackle the issue.
Please note that I am using python 3.5.2, tensorflow 1.1.0, Cuda 8 and CuDnn 5.1
EDIT: when printing sys.path, I get this in PyCharm:
['/home/xxx/pycharm-community-2017.1.2/helpers/pydev', '/home/xxx/pycharm-community-2017.1.2/helpers/pydev', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages', '/usr/local/lib/python3.5/dist-packages/IPython/extensions', '/home/xxx/xxx/xxx']
and this in the terminal:
['', '/usr/local/bin', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages', '/usr/local/lib/python3.5/dist-packages/IPython/extensions', '/home/xxx/.ipython'] |
Python gtk3 filechooser restrict folder | 44,053,546 | 0 | 0 | 518 | 0 | python,ubuntu,gtk,gtk3 | Limiting directory changes isn't directly available in FileChooser, but there are a few ways:
You can define file filters (Gtk.FileFilter) but those basically filter on the file extension (or mime type).
More interesting is that, when changing the folder, a signal is emitted called 'current_folder_changed'. So, you could bind a function to that signal and take action. Mind: if you programmatically change the folder as a result of this signal, the signal will probably be called again, so you have to temporarily block the signal while doing that. | 1 | 1 | 0 | 0 | 2017-05-17T11:16:00.000 | 1 | 1.2 | true | 44,023,311 | 0 | 0 | 0 | 1 | Can gtk filechooser set to be folder-restricted?
A normal filechooser will display all folder files tree starting from / (root), what I need is, to allow filechooser displaying only from /media folder only. So, the top visible folder is only /media, not everything else like /home, /usr, etc.
Thank you for all your kindly help. |
How to run a python program from c++ | 44,025,218 | 0 | 0 | 362 | 0 | python,c++,python-3.x,c++11 | There's POSIX popen and on Windows _popen, which is halfway between exec and system. It offers the required control over stdin and stdout, which system does not. But on the other hand, it's not as complicated as the exec family of functions. | 1 | 1 | 0 | 1 | 2017-05-17T11:41:00.000 | 2 | 0 | false | 44,023,863 | 0 | 0 | 0 | 1 | I am trying to make a program in c++, but i cant make the program because in one part of the code I need to run a python program from c++ and I dont know how to do it. I've been trying many ways of doing it but none of them worked. So the code should look sometihnglike this:somethingtoruntheprogram("pytestx.py"); or something close to that. Id prefer doing it without python.h. I just need to execute this program, I need to run the program because I have redirected output and input from the python program with sys.stdout and sys.stdin to text files and then I need to take data from those text files and compare them. I am using windows. |
worker: Warm shutdown (MainProcess) after task started | 44,094,110 | 2 | 1 | 4,467 | 0 | python,celery,celery-task,celeryd | Using CELERY_ACKS_LATE = True solved the problem | 0 | 1 | 0 | 0 | 2017-05-18T09:18:00.000 | 1 | 1.2 | true | 44,043,579 | 0 | 0 | 0 | 1 | Setup: Celery 3.1, broker=RabbitMQ, backend=Redis.
Scenario:
Having a task is state=STARTED (running) my worker is being restarted. I'm getting worker: Warm shutdown (MainProcess) message (stdout). The worker successfully restarted but the task is stuck on STARTED state (monitored via flower) and nothing happen.
Desired state: I wish that the stuck task will run again (or fail before the shutdown) - and not be ignored and left as 'STARTED' forever. |
Python Watchdog Issue Not triggering Events for files saved by external software | 46,293,315 | 1 | 0 | 885 | 0 | python,filesystems,inotify,watchdog,python-watchdog | Yes it does. Check how is the external program creating the file. In my case, the external program was creating a file with filename initiated with a '.' and ending with '.tmp' and when it is done writing to the temporary file it was moving it to actual filename which is ending with '.json'(for which I have set up the watcher). Only on_moved event is triggered in this case.
Overriding on_moved handler will solve the issue here. | 0 | 1 | 0 | 0 | 2017-05-18T11:36:00.000 | 1 | 0.197375 | false | 44,046,665 | 0 | 0 | 0 | 1 | Does watchdog's "trigger event on file creation" depend on anything specific to how the files are created? I'm finding a discrepancy between when files are saved into a directory by an external program and when they are copied into the directory.
I'm using watchdog to monitor a directory, trigger off new files created in that directory, and then it runs a bunch of other scripts for those files. However I'm having a strange problem. I'm monitoring one directory where new files are saved into it by an external program over time. Watchdog does not trigger when these files appear in the directory. However I'm running a separate instance of the program which monitors a 2nd directory, and when I copy the files into this directory, watchdog triggers as expected and runs the code.
I'm running this on a Linux machine.
Any ideas?
Thanks. |
How to allocate more memory for docker container? | 44,055,755 | 3 | 0 | 808 | 0 | python,docker,flask | By default docker does not restrict memory usage by containers. However, on Mac and Windows installs, Docker runs in a VM and that VM is limited in how much memory it takes from your OS. You can adjust this setting in the Docker preferences for Mac and Windows. | 0 | 1 | 0 | 0 | 2017-05-18T13:03:00.000 | 1 | 1.2 | true | 44,048,555 | 0 | 0 | 1 | 1 | I have python flask app which loads to memory large file (3.5 GB). When I run that app in docker, it doesn't respond to requests, but container somehow works. When I try to run my app without loading that large file to memory it respons to requests. |
How to set real time priority with psutil | 55,455,049 | 1 | 2 | 1,253 | 0 | python,process,psutil | I had exactly the same problem, running python with "as Administrator" solved the issue (On Win10 with python3.7).
Create a windows shortcut to "python " and set "Run as administrator" in the Advanced settings of the shortcut. | 0 | 1 | 0 | 0 | 2017-05-18T13:52:00.000 | 1 | 1.2 | true | 44,049,685 | 0 | 0 | 0 | 1 | How can I set real time priority with psutil. When I try this: process.nice(psutil.REALTIME_PRIORITY_CLASS) REALTIME_PRIORITY_CLASS results in HIGH_PRIORITY_CLASS. |
Cmake files detection | 44,056,709 | 0 | 0 | 145 | 0 | python,cmake | Any file should be explicitely mentioned in CMakeLists.txt in some way for track its changes in CMake.
That is why using GLOB() command for collect sources is not recommended: CMake will not detect automatically whether new source file has been added. | 0 | 1 | 0 | 0 | 2017-05-18T18:13:00.000 | 1 | 1.2 | true | 44,055,109 | 0 | 0 | 0 | 1 | I have a sub-directory in which i have my python files for compilation
I added a new file and accidentally forgot to add it to CMakeList.txt
The problem is that the build was successful.
My question is does CMake detect automatically all the files in the indicated sub-directory? or does it detect any files that have dependencies with other files added to CmakeList.txt?
Thanks. |
Windows environment variable that runs a script | 44,077,157 | 1 | 0 | 45 | 0 | python,windows | No, there is no way to set an environment variable that calls a function when addressed. That's simply not something that environment variables can do. | 0 | 1 | 0 | 0 | 2017-05-19T18:50:00.000 | 1 | 0.197375 | false | 44,077,099 | 1 | 0 | 0 | 1 | Is it possible to set a environment variable in Windows 7 that will run a python script when called? Couldn't do it when I tried. |
Can I distribute a python application with docker? | 44,078,274 | 4 | 1 | 317 | 0 | python,docker | If they have docker then you can distribute your whole application as a docker image. This is the main docker use-case. | 0 | 1 | 0 | 0 | 2017-05-19T19:55:00.000 | 2 | 0.379949 | false | 44,078,101 | 0 | 0 | 0 | 1 | I am developing a python application (a package) that can be distributed with distutils.
I need to share it with someone that does not have python installed.
Is it possible to bundle the entire package and distribute it with docker? |
Messed up with two python versions on linux | 44,082,982 | 0 | 0 | 420 | 0 | python,linux | From what I understood,
You have two version of python. One is in /usr/local/bin/python
and another is in /usr/bin/python.
In your current configuration default python ->
/usr/local/bin/python
You want to use the one that is in /usr/bin.
Update your ~/.bashrc and append this line at the end
alias python=/usr/bin/python
Then open a new terminal. Or do source ~/.bashrc in the current terminal
Run which python to see the location of the python executable. It will show you /usr/bin/python
Also, if you want to get packages in your current python (i.e. /usr/local/bin/python) you can use pip with that particular python version.
Find pip location using which pip
Assuming pip location is /usr/local/bin/pip
/usr/local/bin/python /usr/local/bin/pip install | 0 | 1 | 0 | 0 | 2017-05-20T05:49:00.000 | 2 | 1.2 | true | 44,082,419 | 1 | 0 | 0 | 1 | As I understood, I have two versions of python 2.7 installed on my machine. One is located in /usr/bin and another one is in /usr/local/bin. When I type python in the shell, it calls one in /usr/local/bin, and it doesn't have access to all the packages installed using apt-get and pip. I have tried to set up an alias, but when I type sudo python it still calls one in /usr/local/bin. I want to always use one in /usr/bin, since I have all the packages there. How do I do that? |
Trying to open Google Earth via a Script, file path nonexistent | 44,089,362 | 0 | 0 | 103 | 0 | python,terminal,filepath | Two problems going on here:
1) That path is probably correct. You're not using find correctly, in particular. You need to do sudo find / -name "*.app" (note the quotes around *app). From the man page:
-iname pattern
Like -name, but the match is case insensitive. For example, the patterns 'fo*' and 'F??' match the file names 'Foo', 'FOO', 'foo', 'fOo', etc. In these patterns, unlike filename expansion by the shell, an initial '.' can be matched by '*'. That is, find -name *bar will match the file '.foobar'. Please note that you should quote patterns as a matter of course, otherwise the shell will expand any wildcard characters in them.
2) Try using subprocess.Popen(["/Applications/Google Earth.app"], shell=True). Don't worry too much about security problems with shell=True unless you are taking user input. If it's just hardcoded to use your path to Google Earth, you're fine. If you have user input in your logic, however, DO NOT use shell=True. shell=True just means that shell metacharacters will work if they are in the command. The reason you need it is that subprocess.Popen() will have trouble parsing your command since there is a space in the path. Alternatively, you could just use os.system("/Applications/Google Earth.app"). | 0 | 1 | 0 | 0 | 2017-05-20T17:43:00.000 | 1 | 1.2 | true | 44,089,046 | 0 | 0 | 0 | 1 | I am trying to build a script that opens the Google Earth.app which I can see in Finder, but when I go to the applications folder it is not present. I looked at some other posts to find the filepath of Google Earth.app via sudo find / -iname *.app, which was /Applications/Google Earth.app. When I try and find this file I get 'No such file or directory'. Could some one please explain why you applications that are in Finder don't show up in terminal? Also how would I find the correct file path so I can use subprocess.Popen() to open Google Earth in Python. |
[Python ]google app engine deploying the file to server | 44,226,486 | 1 | 0 | 22 | 0 | python,google-app-engine | You cannot to my knowledge edit the codebase once it's uploaded - it can only be modified locally. If you want to access app engine have a look at appengine.google.com . If you look under "Versions" you'll see some the links to the version(s) of your app. | 0 | 1 | 0 | 0 | 2017-05-21T13:25:00.000 | 1 | 1.2 | true | 44,097,436 | 0 | 0 | 1 | 1 | Hello I did a hello world python application in local host and then I deployed it to the google app engine using google application launcher but I don't know where access it inside the google app engine from inside the dashboard.And is there any way through which I can edit the hello world once its uploaded to app engine.
I went through their tutorial but I am stuck right here . |
How to install a module to one of many pythons in Fedora 20 | 44,102,104 | 0 | 0 | 311 | 0 | python,module | Check if pip36 or more likely pip3 is a function you can run. Often times the pip command corresponds to the first installed python version, so if you install one later it gets the suffix according to its version. If that is the case then you'll want to do pip36 (pip3) install moduleXYZ. | 0 | 1 | 0 | 0 | 2017-05-21T21:42:00.000 | 2 | 0 | false | 44,102,086 | 1 | 0 | 0 | 1 | I have on my Fedora 20 additionally to 2.7 a python3.6 version installed.
When I run a script with the 3.6 version it's missing the requests module.
When I try to install it with the pip command it says it's already there.
So, how can I install this module in python3.6?
Any hints?
Thanks |
Getting Terminal to do something else while running a localhost on it. | 44,108,967 | 0 | 0 | 35 | 0 | python,google-app-engine,terminal | That instance of the terminal will be busy doing the thing you asked it to. But you can just open a new window or tab. | 0 | 1 | 0 | 0 | 2017-05-22T08:55:00.000 | 1 | 1.2 | true | 44,108,625 | 0 | 0 | 0 | 1 | How come I can't do anything else on terminal when It's running a localhost. Like I run a google app engine on it and make a new local host, I for example try to see what directory I'm in or even change directories, it doesn't respond to any of my requests? Thank you |