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
Related
I am using Splunk 8+ and Python 3.6. I am trying to run this https://github.com/0x616c6578/TA-geoip2 plugin.
I get this error message when I look into search.log and try to run the Python command in the log by itself:
C:\Users\strozllc>"C:\Program Files\Splunk\bin\Python3.exe" "C:\Program Files\Splunk\etc\apps\TA-geoip2-main\bin\geoip-command.py
Traceback (most recent call last):
File "C:\Program Files\Splunk\etc\apps\TA-geoip2-main\bin\geoip-command.py", line 8, in <module>
from splunklib.searchcommands import \
File "C:\Program Files\Splunk\etc\apps\TA-geoip2-main\bin\..\lib\splunklib\searchcommands\__init__.py", line 145, in <module>
from .environment import *
File "C:\Program Files\Splunk\etc\apps\TA-geoip2-main\bin\..\lib\splunklib\searchcommands\environment.py", line 20, in <module>
from logging.config import fileConfig
File "C:\Program Files\Splunk\Python-3.7\lib\logging\config.py", line 30, in <module>
import logging.handlers
File "C:\Program Files\Splunk\Python-3.7\lib\logging\handlers.py", line 26, in <module>
import logging, socket, os, pickle, struct, time, re
File "C:\Program Files\Splunk\Python-3.7\lib\socket.py", line 49, in <module>
import _socket
ImportError: Module use of python27.dll conflicts with this version of Python
n.
Huh? I looked at line 8 in geocommand.py and it is from
splunklib.searchcommands import \
dispatch, StreamingCommand, Configuration, Option, validators
I look it C:\Program Files\Splunk\bin, and there is indeed a python27.dll. But how is it getting called?
This is a case of Python 3 trying to run Python 2 code. The latest versions of Splunk (you didn't say which one you're using) only support Python 3 so an error will be thrown when an outdated library file is encountered.
I'd suggest filing an issue on GitHub, but the app appears to be abandonware since it hasn't been touched in a year despite having 4 issues.
Consider forking the code and updating it yourself.
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'm attempting to use Xlwings for Python, however having installed Python 3.5, pywin32 extensions and Xlwings I get the following error when starting import:
from xlwings import workbook
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from xlwings import workbook
File "C:\Python 3.5\lib\site-packages\xlwings\__init__.py", line 18, in <module>
from . import _xlwindows as xlplatform
File "C:\Python 3.5\lib\site-packages\xlwings\_xlwindows.py", line 15, in <module>
import pywintypes
File "C:\Python 3.5\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Python 3.5\lib\site-packages\win32\lib\pywintypes.py", line 117, in __import_pywin32_system_module__
assert sys.modules[modname] is not old_mod
AssertionError
Try commenting out the asserts (replace them with a pass) and see if it works. Otherwise you're going to need to debug pywintypes.
Felix Zumstein just informed me that the above suggestion won't work:
When you comment out those lines, then it fails further down when doing from pywintypes import TimeType: ImportError: cannot import name 'TimeType'
However, downgrading may solve this problem.
After Much trial and error ive found that downgrading to Python 3.3 works
Thnak you for all the responses
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.
After installing Lion, Aptana has stopped working -- I can no longer run any Python code, despite me failing to find any other problems with Python my system. I've tried restoring defaults in Aptana, re-installing and looking for any missing references in Aptana to python components.
Running a simple "hello world" .py script generates a console message:
Traceback (most recent call last):
File "/Applications/Aptana Studio 3/plugins/org.python.pydev.debug_2.2.1.2011073123/pysrc/runfiles.py", line 159, in <module>
main()
File "/Applications/Aptana Studio 3/plugins/org.python.pydev.debug_2.2.1.2011073123/pysrc/runfiles.py", line 25, in main
import pydev_runfiles
File "/Applications/Aptana Studio 3/plugins/org.python.pydev.debug_2.2.1.2011073123/pysrc/pydev_runfiles.py", line 5, in <module>
import pydev_runfiles_unittest
File "/Applications/Aptana Studio 3/plugins/org.python.pydev.debug_2.2.1.2011073123/pysrc/pydev_runfiles_unittest.py", line 6, in <module>
import pydev_runfiles_xml_rpc
File "/Applications/Aptana Studio 3/plugins/org.python.pydev.debug_2.2.1.2011073123/pysrc/pydev_runfiles_xml_rpc.py", line 1, in <module>
from pydev_imports import xmlrpclib
File "/Applications/Aptana Studio 3/plugins/org.python.pydev.debug_2.2.1.2011073123/pysrc/pydev_imports.py", line 14, in <module>
from _pydev_SimpleXMLRPCServer import SimpleXMLRPCServer
File "/Applications/Aptana Studio 3/plugins/org.python.pydev.debug_2.2.1.2011073123/pysrc/_pydev_SimpleXMLRPCServer.py", line 116, in <module>
import BaseHTTPServer
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py", line 81, in <module>
import mimetools
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/mimetools.py", line 6, in <module>
import tempfile
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/tempfile.py", line 34, in <module>
from random import Random as _Random
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/random.py", line 45, in <module>
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
ImportError: dlopen(/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/math.so, 2): Symbol not found: __PyLong_AsScaledDouble
Referenced from: /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/math.so
Expected in: flat namespace
in /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/math.so
Have you tried removing your interpreter and adding it again (that way PyDev would update your PYTHONPATH?
It seems like the problem is that the math.so is not compatible with the latest changes in Lion (so, maybe in the update for Lion it got to 2.7 and you're still with 2.6 in the PYTHONPATH configure in Eclipse?)
For me, a better choice would be using an interpreter downloaded from python.org (where you have more control and don't need to rely on what Mac gives you) and configure the python from python.org.
See: http://pydev.org/manual_101_interpreter.html