Closed Cobertos closed 6 years ago
Where is the bpy.pyd
file actually located on disk?
It's a very weird module in that bpy.pyd
lives in C:\python35\Lib\site-packages
and then loads all of it's supporting non-compiled Python resources from C:\python35\2.78
where 2.78
is the Blender version. For more insight, the final step of the build process looks something like:
copy bin\bpy.pyd C:\Python35\Lib\site-packages\
copy bin\*.dll C:\Python35\Lib\site-packages\
del C:\Python35\Lib\site-packages\python35.dll
xcopy /E bin\2.78 C:\Python35\2.78\
Calling import bpy
in an interactive python session will load the module bpy
fine and also allow for other Blender modules to load like mathutils
. If you try import mathutils
before import bpy
it won't work.
You ran pytest on the whole project, but green on just one test file. Might as well try python -m green
and see if that behaves any differently.
Other than that, I'm stumped. I don't use Blender or Windows, and without being able to poke around I'm not sure there's anything else I can do.
Any Windows experts out there want to give this one a shot?
Or blender experts?
It behaves the same and gives similar output for each file if I just run python -m green
or green
. I'll report back with any more information but I'm as stumped as you are.
In the meantime, it looks like if anything it's going to be something in bpy_interface.c
or bpy_internal_import.c
(the second one monkey-patches Python's import function apparently) and is then probably a Blender problem but I'll let you know
You're probably right, so I'm going to go ahead and close this issue. But if you find some new information that would point to a way that we could fix it in green, feel free to reopen.
I'm trying to run suite of tests that target Blender and I get the following error.
I have also included my file heirarchy:
To give a bit of background on how Blender in Python works, Blender is compiled into a
bpy.pyd
file imported throughimport bpy
whereby a headless Blender process will be spun up and the root python object is accessible in the current python environment. I see that this might be problematic according to https://github.com/CleanCut/green/issues/163.Upon creating a minimal test case, the failure does indeed hinge on
import bpy
. Removing it will cause the tests that don't rely on Blender (only a select few) to be found and run properly.I'm only posting this because while it doesn't work in
green
, I just tried and it does work inpytest
(see below). From my experience with Blender as a Python module, I assume that Blender does some really weird import machinery rewriting to handle all its internal stuff but ultimately I'm not sure whypytest
works andgreen
does not.If there is more troubleshooting information I can provide, let me know. I wasn't really sure where to go from here.
Pytest: