You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got an error like title and found a workaround
The cause is in "hook-clr.py"
The pythonnet used by pyaedt has been extended and renamed
so, you need to create "hook-clr.py" in source folder or somewhere:
fromPyInstaller.utils.hooksimportis_module_satisfiesfromPyInstaller.compatimportis_winifis_module_satisfies("ansys-pythonnet"):
# pythonnet requires both clr.pyd and Python.Runtime.dll, but the latter isn't found by PyInstaller.importctypes.utilfromPyInstaller.logimportloggertry:
importimportlib.metadataasimportlib_metadataexceptImportError:
importimportlib_metadatacollected_runtime_files= []
# Try finding Python.Runtime.dll via distribution's file listdist_files=importlib_metadata.files('ansys-pythonnet')
ifdist_filesisnotNone:
runtime_dll_files= [fforfindist_filesiff.match('Python.Runtime.dll')]
iflen(runtime_dll_files) ==1:
runtime_dll_file=runtime_dll_files[0]
collected_runtime_files= [(runtime_dll_file.locate(), runtime_dll_file.parent.as_posix())]
logger.debug("hook-clr: Python.Runtime.dll discovered via metadata.")
eliflen(runtime_dll_files) >1:
logger.warning("hook-clr: multiple instances of Python.Runtime.dll listed in metadata - cannot resolve.")
# Fall back to the legacy wayifnotcollected_runtime_files:
runtime_dll_file=ctypes.util.find_library('Python.Runtime')
ifruntime_dll_file:
collected_runtime_files= [(runtime_dll_file, '.')]
logger.debug('hook-clr: Python.Runtime.dll discovered via legacy method.')
ifnotcollected_runtime_files:
raiseException('Python.Runtime.dll not found')
# On Windows, collect runtime DLL file(s) as binaries; on other OSes, collect them as data files, to prevent fatal# errors in binary dependency analysis.ifis_win:
binaries=collected_runtime_fileselse:
datas=collected_runtime_files# These modules are imported inside Python.Runtime.dllhiddenimports= ["platform", "warnings"]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
hi everyone
I got an error like title and found a workaround
The cause is in "hook-clr.py"
The pythonnet used by pyaedt has been extended and renamed
so, you need to create "hook-clr.py" in source folder or somewhere:
then:
or simple as 'pip install pythonnet'...
but idk which idea is good...
Beta Was this translation helpful? Give feedback.
All reactions