I've been trying to get a script to run on a Windows server. It runs fine on my Mac, but keeps throwing an error at the end of the script. The output from the script is as expected and completes entirely, then this error is thrown:
Fatal Python error: PyImport_GetModuleDict: no module dictionary
Current thread 0x00001880 (most recent call first):
File "C:\Python37\lib\site-packages\pycares\__init__.py", line 387 in (lambda)
Currently I'm running Python 3.6.5 and getting this error but I've tried it up to Python 3.7.5 and get the same error. This seems like a Windows specific issue with Pycares since the same script runs fine on my Mac machine. Since the script executes correctly, even on windows, this seems like it is an error thrown in the cleanup of the script.
Any ideas on a cause or a workaround?
Edit: I've found this Python bug https://bugs.python.org/issue26153 that seems to say it's due to a race condition and warnings in the del function, but I still get the issue even when running Python 3.7
Related
I am trying to run Python script from SSIS but I am getting the below error
I have also tried using unwell_v2.py and that also gives me the error "The process exit code was 1 while the expected was 0"
exit code 2 error went away by changing the argument file to .py
and exit code 1 meant that there was some issue with the python script in my case. So I ran the python script independently using spyder and fixed it. It ran perfectly after that.
I am using Windows 10, and Python 3.6 (installed at C:\Users\George\Anaconda3\python.exe). I have also installed Atom and am trying to use it as a python development environment with the script package.
An issue I consistently come across with is running my code using script. Checked other answers here but to no avail.
As an example, this is some code in a atom-test.py file:
import numpy as np
myArray = np.array([1,2,3,4])
print(np.sum(myArray))
When I run it using ctrl+b (I changed ctrl+shift+b to ctrl+b), I get this error:
Traceback (most recent call last):
File "C:\Users\George\atomtest1.py", line 1, in <module>
import numpy as np
ImportError: No module named 'numpy'
However, the module is imported because I can easily do this with terminal and it works fine.
Then I realized that manually running the script from profile by going to Package>Script>Run with profile then selecting the profile where python is set in the command (in my case Users/George/Anaconda3/python.exe) then it works fine.
10
[Finished in 0.793s]
So what can I do to get it to run there just by selecting ctrl+b?
I've encountered this problem many times. A workaround that works for me is to just keep trying to run the script and restart Atom. After a while, it kicks in and runs and all is fine. I know this answer sucks but it works for me. I just now ran into this problem. It started working on 3rd restart and continued for a while.
I installed python 2.7.10 on my 1and1 linux hosting service about 8 months ago (using instructions from http://geeksta.net/geeklog/python-shared-hosting/) and everything was working fine (I had a daily cron job that would call my python script). But recently,my python script stopped working and it appears that the call to python itself is the culprit, rather than the python code. Whenever I type 'python' into the command line in the 1and1 unix ssh session now, i get the following error message
"-bash: /kunden/homepages/26/xxxxxxxxxx/htdocs/python27/bin/python: No
such file or directory"
It's been awhile since I installed things, but I don't believe I had this issue previously. I'm trying to figure out why it's not working and what I can do to get it fixed. It appears that calling python isn't working properly (which would affect my script as well).
Any help with getting this working would be greatly appreciated.
when you type python, system find it in /kunden/homepages/26/xxxxxxxxxx/htdocs/python27/bin/python, but there is no such a file in fact.
what you need to do is trying to locate your python binary executable file, and alias your python to your file
I ended up just reinstalling python 2.7 again and it works again. Not sure why it stopped working before.
Now I can type "python" in the command line and it starts the Python console.
I've made a single-threaded Python program in PyDev, and after the program executes and reports that it's done, I get the following error message:
Exception in thread pydevd.CommandThread (most likely raised during interpreter shutdown):
It doesn't affect how my program runs, but it would be nice to have it not show up. I've run the program on the command line, and it doesn't produce any error messages like this.
Any suggestions?
Apparently it was the way I was writing to a file using the built-in json library.
I don't know why or if it was wrong, but I stopped the error by using
file.write(json.dumps(dict, indent=4))
instead of
json.dump(dict, file, indent=4)
I'm not sure why this was producing the error, but changing this made it stop. If anyone can let me know why, that would be great.
I work in PyDev and quite suddenly, I cannot run my python programs from within Eclipse's PyDev (version 2.1.0) anymore.
Any python program I have ran through Run As > Python Run fails wioth
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
File "C:\Python32\lib\io.py", line 60, in <module>
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
I can still run my program in command Line, only Eclipse * I have only one version of Python (3.2)
I haven't changed my python files since last time they worked. They are encoded UTF-8.
I haven't upgraded Eclipse nor PyDev since last time they worked
Python is installed in c:\python32 (defined in the environment variable PYTHONPATH)
My XP system has been updated today for KB2536276 and
Any idea?
I have finally found out where the problem came from: I had a file called stat.py and this is apparently creating a conflict with Lib/stat.py
Unfortunately the error message was very obscure.
And I just don't understand why pyDev behaves differently than python.exe