Hi,
I want to use a 3rd party library. For example, the Deadline Standalone API but it throws such an import error.
PS C:\Users\AdminTest\Desktop> & "C:\Program Files\Thinkbox\bin\deadlinecommand.exe" -executescript slaves_calc.py
Qt: Untested Windows version 10.0 detected!
Error: ImportError : No module named DeadlineConnect
File "C:\Users\AdminTest\Desktop\slaves_calc.py", line 1, in <module>
from Deadline.DeadlineConnect import DeadlineCon as Connect
I have added Deadline Standalone API library to C:\Program Files\Thinkbox\bin\pythonsync, C:\Program Files\Thinkbox\bin\Lib\site-packages here.
Thanks, but that’s not what I mean. I’ve already written the whole system with standalone api. But I need deadline scripting. I have to run with -executescript for it.
The problem is they are mutually exclusive, you cant really mix them.
you could try to import the standalone api into a scripting session … but i wouldnt recommend it, sure its good for some situations.
@eamsler you have to have a good explanation why this is not the best way to work?
The big issue with mixing them is that the namespaces collide and the standalone API is masked off after Python.net loads in the virtual modules from C#. Here’s some code for example:
import Deadline.DeadlineConnect as Thing1
import Deadline.Scripting as Thing2
Even with Deadline configured to use your site-packages you’ll see this:
c:\Program Files\Thinkbox\Deadline10\bin>deadlinecommand executescript C:\Users\me\Downloads\import-test.py
Qt: Untested Windows version 10.0 detected!
Error: ImportError : No module named DeadlineConnect
File "C:\Users\me\Downloads\import-test.py", line 1, in <module>
import Deadline.DeadlineConnect as Thing1
For how to add Python modules, you can check the docs here.
Update: You could do something sneaky like rename the “Deadline” folder in your site-packages to “DeadlineConnect”. That’ll at least fix the conflict, but all of your imports will be non-standard.