AWS Thinkbox Discussion Forums

After Effects - ImportError: cannot import name 'open_code' from 'io'

So I’m running into an issue with one of my Mac users when using the SubmitAEToDeadline.jsx they get this error. It is only happening with this one specific computer. Running Monterey, Deadline 10.2 and using Shotgun Desktop to launch and create the projects. I have 8 other users not experiencing this issue so I thought would check here before I do a complete wipe of the Mac and start fresh.
I have reinstalled everything multiple times and my googling pulls up that this is possibly a Python/permissions issue? Not really sure what is going on here since it’s also including Shotgun app.

Fatal Python error: init_sys_streams: can’t initialize sys standard streams

Traceback (most recent call last):
File “/Applications/Shotgun.app/Contents/Resources/Python3/lib/python3.9/io.py”, line 54, in
ImportError: cannot import name ‘open_code’ from ‘io’ (unknown location)
Deadline Command 10.2 [v10.2.0.9 Release (896353057)]

Given it’s a file from inside Shotgun.app that’s failing to be loaded - maybe give that a re-install? And failing that try Deadline, as we should be making use of a Shotgun API that we bring along oursolves instead of what’s on the system.

At least before starting fresh on the Mac. :slight_smile:

I get this exact same error when using deadlinecommand to submit from a shell with Python 3.9 in the PATH. This seems to be a common error when mixing pre- and post-3.8 versions of Python (Deadline uses Python 3.7 as of v10.2.1.1).

SG Desktop dropped Python 3.7 as of Jan. 9, 2023, so if the problem machine updated recently that might be the cause. The VFX Reference Platform has been Python 3.9 since CY2022, so current versions of most DCCs are expecting >=3.9.

PS > rez env python-3.9

You are now in a rez-configured environment.

resolved by <removed>, on Tue Jul 11 13:31:58 2023, using Rez v2.111.3

requested packages:
python-3.9
~platform==windows           (implicit)
~arch==AMD64                 (implicit)
~os==windows-10.0.19041.SP0  (implicit)

resolved packages:
arch-AMD64                 C:\RezCache\arch\AMD64\c16e\a                 (cached)
os-windows-10.0.19041.SP0  C:\RezCache\os\windows-10.0.19041.SP0\d341\a  (cached)
platform-windows           C:\RezCache\platform\windows\b034\a           (cached)
python-3.9.7               C:\RezCache\python\3.9.7\fb56\a               (cached)
> $ & "C:\Program Files\Thinkbox\Deadline10\bin\deadlinecommand" JobInfo0.txt PluginInfo0.txt cmds.txt
Deadline Command 10.2 [v10.2.1.1 Release (094cbe890)]
Fatal Python error: init_sys_streams: can't initialize sys standard streams
Traceback (most recent call last):
  File "C:\RezCache\python\3.9.7\fb56\a\python\lib\io.py", line 54, in <module>
ImportError: cannot import name 'open_code' from 'io' (unknown location)
1 Like

Deadline 10.1.20.x to latest comes with python 3.7.12 packaged and run it by default. I tried importing io.open_code() and0 it didn’t work with Deadline python. I Installed python 3.10 locally on my machine and imported io.open_code() successfully with below command.

>>> from io import open_code

I couldn’t find a workaround to this issue, even with adding an additional search path for Python in Deadline. It seems to load the ‘io’ module from the $Deadline_Path\python3\Lib.

We already have an internal ticket to support Python 3.10 and our development team is working on it. Look forward to Deadline Release Notes for future bug fixtures and feature releases. (Release History — Deadline 10.2.1.1 documentation)

I can say that the next release of Deadline will be coming with Python 3.10 out of the box, so it will be worth waiting. Unfortunately we don’t have a date we can offer.

Privacy | Site terms | Cookie preferences