I have a python program that used Tkinter, matplotlib, numpy.
It was builded successfully on my windows 8 host system by py2exe and running as well.
I have one system based on windows 7 where this program (builded on windows 8) working too.
But when i trying to start this program on windows xp sp3, i get error in log file with a content of:
Traceback (most recent call last):
File "DrawPlots.py", line 6, in <module>
File "graph_ani2.pyc", line 4, in <module>
File "numpy\__init__.pyc", line 170, in <module>
File "numpy\add_newdocs.pyc", line 13, in <module>
File "numpy\lib\__init__.pyc", line 8, in <module>
File "numpy\lib\type_check.pyc", line 11, in <module>
File "numpy\core\__init__.pyc", line 46, in <module>
File "numpy\testing\__init__.pyc", line 13, in <module>
File "numpy\testing\utils.pyc", line 15, in <module>
File "tempfile.pyc", line 35, in <module>
File "random.pyc", line 885, in <module>
File "random.pyc", line 97, in __init__
File "random.pyc", line 113, in seed
WindowsError: [Error -2146893795]
As i can suggest - is it problem with numpy? If yes, then how can i resolve it?
I faced a similar problem, PyFactura issue #3, the solution seems to be removing crypt32.dll from the bundled DLLs (py2exe setup options, for more info see aws-cli):
# basic options for py2exe
opts = {
'py2exe': {
'dll_excludes': ['crypt32.dll'],
}
}
You may need to exclude other specific Windows 8.1 DLL too (API-MS-Win-Core-*.dll)
I also had this error, concretely this output:
WindowsError: [Error -2146893795] Provider DLL failed to initialize correctly
This happened at a call to os.urandom.
This was in a subprocess.
The bug for me was that I called _subprocess.CreateProcess with an env_mapper = {'foo': 'bar'}. The fix:
env_mapper = os.environ.copy()
env_mapper.update({'foo': 'bar'})
Note that there is a related question here.
And some discussion on this GitHub issue.
And this related Python bug.
All those seem to be related to crypt32.dll in a frozen Python app, or via py2app.
Related
I'm trying to get the Revit python shell debugger working in my dynamo but I'm running into issues. It seems to run in Revit alright but I cant get the debugger in dynamo to work as shown here.
Also if anyone has any other methods for debugging python code in Revit, feel free to let me know!
Here is the error I'm getting:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File "<string>", line 13, in <module>
File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\__init__.py", line 36, in <module>
File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\db\__init__.py", line 19, in <module>
File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\db\view.py", line 10, in <module>
File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\db\collector.py", line 35, in <module>
File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\ui\__init__.py", line 1, in <module>
File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\ui\forms\__init__.py", line 12, in <module>
File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\ui\forms\flexform.py", line 6, in <module>
File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\ui\forms\resources.py", line 41, in <module>
File "C:\Program Files\Autodesk\Revit 2021\AddIns\DynamoForRevit\IronPython.StdLib.2.7.9\wpf.py", line 11, in <module>
ImportError: No module named _wpf
Which is odd because it seems I have the package located in the directory from the install.
This is what my Dynamo looks like. its the getting started file that comes with RPW.
Here is what I've tried so far:
I've added this path to my searching path here: "C:\Program Files (x86)\IronPython 2.7\Platforms\Net40" according to this post.
Here is an image of my searching path:
RPS works in Revit but doesn't work in dynamo for debugging python scripts.
Here are the contents of wpf.py
#-*- coding: ISO-8859-1 -*-
def _():
import sys
if sys.platform == 'cli':
import clr
clr.AddReference('IronPython.Wpf')
_()
del _
from _wpf import *
any and all help would be appreciated!
So after hours of testing different things, I finally tried to just open the wpf.py file and change the line:
from _wpf import *
to
from wpf import *
and I'm now able to access rpw in dynamo.
but I cant get the debugger working in pycharm still.
I also added the paths to the Net40 folder, the unzipped rpw folder that comes in the install, and the location of my iron python folder
I am fairly new to Python and I need some help with an error message I am receiving. I am trying to make an exe file from a tkinter script with the help of py2exe, but I keep getting an AssertionError whenever I try to run the setup.py script. I have already created an exe file on my computer only a couple of days ago out of the same script without using tkinter. Creating this exe file was no problem. I am wondering if the error message occurs due to the fact that I have already created an exe file recently.
My setup.py script looks normal:
`# setup.py
from distutils.core import setup
import py2exe
setup(console=['MyScript.py'])`
Whenever I run it, I get this error:
AssertionError: distutils has already been patched by <class 'py2exe.patch_distutils.patch_distutils.<locals>.Distribution'>
The entire traceback looks like this:
Traceback (most recent call last):
File "C:\Dir\JetBrains\PyCharm Community Edition 2016.2.3\helpers\pycharm\pycharm_setup_runner.py", line 26, in <module>
exec (fh.read(), globals(), locals())
File "<string>", line 6, in <module>
File "C:\Dir\Python3\lib\distutils\core.py", line 134, in setup
ok = dist.parse_command_line()
File "C:\Dir\Python3\lib\distutils\dist.py", line 471, in parse_command_line
args = self._parse_command_opts(parser, args)
File "C:\Dir\Python3\lib\distutils\dist.py", line 527, in _parse_command_opts
cmd_class = self.get_command_class(command)
File "C:\Dir\Python3\lib\distutils\dist.py", line 817, in get_command_class
__import__ (module_name)
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.2.3\helpers\pycharm\pycharm_commands\pycharm_test.py", line 4, in <module>
from setuptools.command import test
File "C:\Dir\Python3\lib\site-packages\setuptools\__init__.py", line 14, in <module>
from setuptools.extension import Extension
File "C:\Dir\Python3\lib\site-packages\setuptools\extension.py", line 10, in <module>
from .dist import _get_unpatched
File "C:\Dir\Python3\lib\site-packages\setuptools\dist.py", line 39, in <module>
_Distribution = _get_unpatched(_Distribution)
File "C:\Dir\Python3\lib\site-packages\setuptools\dist.py", line 35, in _get_unpatched
"distutils has already been patched by %r" % cls
AssertionError: distutils has already been patched by <class'py2exe.patch_distutils.patch_distutils.<locals>.Distribution'>
Does anyone know a workaround to this problem? I am working in Python3.4.1.
Thank you so much for helping!
Try importing setuptools before you import py2exe.
It worked for me.
I'm using module transliterate.py from standard translit python libraries.
When I compile my GUI application, it raises the next error.
Traceback (most recent call last):
File "C:\Users\...\...\build\Rman\out00-PYZ.pyz\addobjectdialog", line 265, in OnTextName
File "C:\Users\...\...\build\Rman\out00-PYZ.pyz\core.utils", line 536, in translit
File "C:\Users\...\...\build\Rman\out00-PYZ.pyz\transliterate.utils", line 41, in translit
File "C:\Users\...\...\build\Rman\out00-PYZ.pyz\transliterate.utils", line 29, in ensure_autodiscover
File "C:\Users\...\...\build\Rman\out00-PYZ.pyz\transliterate.discover", line 27, in autodiscover
WindowsError: [Error 3] : 'C:\\...\\...\\AppData\\Local\\Temp\\_MEI11122\\transliterate\\contrib\\languages/*.*'
How I understand, I have to place
that lib somewhere within my application. But I just compile one .exe file, so wouldn't like to keep yet one file with my exe.
BTW, app is ran under Win 7 / 32bit.
Thanks.
That may be one of those libraries that you have to include explicitly. I know I had to do that from time to time with py2exe. See the following docs for more information:
http://pythonhosted.org/PyInstaller/#options-for-finding-imported-modules-and-libraries
I've attempted to create a pretty basic executable with pyinstaller, but when I run it winpexpect (a windows version of pexpect) throws me a pretty undecipherable error. I've really only been able to deduce that the error occurs when using the winspawn class.
C:\Users\Dan\Dropbox\Programming\Python\MC\ServerSense>ServerSense.exe
Traceback (most recent call last):
File "<string>", line 170, in <module>
File "<string>", line 52, in __init__
File "C:\Users\Dan\Dropbox\Programming\Python\Packagers\PyInstaller\PyInstalle
r-2.1\ServerSense\build\ServerSense\out00-PYZ.pyz\winpexpect", line 346, in __in
it__
File "C:\Users\Dan\Dropbox\Programming\Python\Packagers\PyInstaller\PyInstalle
r-2.1\ServerSense\build\ServerSense\out00-PYZ.pyz\pexpect", line 429, in __init_
_
File "C:\Users\Dan\Dropbox\Programming\Python\Packagers\PyInstaller\PyInstalle
r-2.1\ServerSense\build\ServerSense\out00-PYZ.pyz\winpexpect", line 401, in _spa
wn
pywintypes.error: (2, 'CreateProcess', 'The system cannot find the file specifie
d.')
Can anyone provide some insight as to how I'd go about packaging winpexpect with pyinstaller? It doesn't even seem to be letting me know which file it can't find.
Figured it out, I used the fork of winpexpect over here: https://bitbucket.org/weyou/winpexpect/wiki/Home
Which has cx_freeze support, (py2exe works too, it's what I used.)
I installed pygui and pywin32 for my 64-bit python 2.7 (I installed 64-bit for those too) and when I try to use pygui, which uses pywin32, python gives me this error.
I'm sure that other people might have similar problems.
Traceback (most recent call last):
File "C:\Users\MY_USERNAME_HERE\Dropbox\Python Programs\BlobEdit\BlobEdit.py", line 16, in <module>
from GUI import Application, ScrollableView, Document, Window, Cursor, rgb
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\__init__.py", line 94, in <module>
import GUI.Application
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\Application.py", line 11, in <module>
from GUI.GApplications import Application as GApplication
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\GApplications.py", line 14, in <module>
from GUI.Printing import PageSetup, present_page_setup_dialog
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\Printing.py", line 11, in <module>
from GUI import Canvas
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\Canvas.py", line 15, in <module>
from GUI.StdFonts import application_font
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\StdFonts.py", line 9, in <module>
from GUI import Font
File "C:\Program Files\python2.7.2\lib\site-packages\GUI\Font.py", line 56, in <module>
pywin32_info = api.GetFileVersionInfo(api.__file__, '\\')
error: (1813, 'GetFileVersionInfo:GetFileVersionInfoSize', 'The specified resource type cannot be found in the image file.')
Apparently, PyWin32 can't find it's version or something. I wonder why.
I've had this issue, which led me to this question.
I'm using python 3.3 and had already installed pywin32-218, so my solution was this hack in Font.py:
#pywin32_info = api.GetFileVersionInfo(api.__file__, '\\')
pywin32_build = 218 # pywin32_info['FileVersionLS'] >> 16
I've had this issue too, easy solution: install the minimum required pywin32 version 213. Somewhere there a version check happening in pywin32 on some file. Perhaps some day i will dig into it further and post a more detailed post and/or file a bug