the common way I've found (experimenting with freetype-py in collaboration with the devs) to use a custom DLL search path (which is better than my last suggestion of including the dll with pyassimp) is to update os.environ['PATH'] with the custom directory like so:
import os
DLL_directory = os.path.sep.join( ( os.getcwd(), 'DLLS','' ) ) # the '' dynamically adds an extra \ or / like other directories
os.environ['PATH'] = os.pathsep.join((os.environ['PATH'],DLL_directory))
import pyassimp
I can't seem to fix this one as easy as I did with my last suggestion...
ok, the dll wouldn't even work in the CWD... just found out why and fixed:
helper.py
def search_library():
"""Loads the assimp-Library.
result (load-function, release-function)
exception AssimpError if no library is found
"""
#this path
folder = os.getcwd() #os.path.dirname(__file__)
---snip---
so I got that much working...
the problem is Wine and __file__
>>> os.path.dirname(__file__)
\home\tcll\Desktop\modern 3D viewer\pyassimp
>>> os.getcwd()
Z:\home\tcll\Desktop\modern 3D viewer
unless you guys wanted it to search pyassimp instead of the CWD
EDIT:
forget what I said... what you guys did was better because the CWD isn't always the .py directory.
so I just restored it and removed 'pyassimp' to get it working...
however... explain this:
>>>
Z:\copy\Tcll\modern 3D viewer\
OpenGL
pyassimp
3d_viewer.py
DLLS
pyglfw
assimp.dll
WARNING:pyassimp:[Error 126] The specified module could not be found
scipy
numpy
Traceback (most recent call last):
File "Z:\copy\Tcll\modern 3D viewer\3d_viewer.py", line 49, in <module>
import pyassimp
File "Z:\copy\Tcll\modern 3D viewer\pyassimp\__init__.py", line 1, in <module>
from .core import *
File "Z:\copy\Tcll\modern 3D viewer\pyassimp\core.py", line 213, in <module>
class AssimpLib(object):
File "Z:\copy\Tcll\modern 3D viewer\pyassimp\core.py", line 217, in AssimpLib
load, release, dll = helper.search_library()
File "Z:\copy\Tcll\modern 3D viewer\pyassimp\helper.py", line 153, in search_library
raise AssimpError("assimp library not found")
AssimpError: assimp library not found
>>>
try harder python
You can use a special script to start your application, which adds the dll path to the PATH before starting the python-app.
Read the first comment
Ah, thanks a lot for the hint.
In a plain old windows command shell (Win10), I couldn't make the cwd or path methods work, even if running in the same directory as the DLL. I had a look at helper.py and saw the bit about dirname(__file__)... Accordingly, I copied the assimp and zlib dll's to C:\Python27\lib\site-packages\pyassimp where the scripts are installed and now pyassimp works. I'm not sure if this is a terrible solution in general, but it works for my set up.