AcademySoftwareFoundation / rez

An integrated package configuration, build and deployment system for software
https://rez.readthedocs.io
Apache License 2.0
927 stars 329 forks source link

AttributeError: 'NoneType' object has no attribute 'fileno' #1450

Closed KelSolaar closed 1 year ago

KelSolaar commented 1 year ago

Hello,

I'm trying to start some of our processes via rez using Epic Games' Switchboard Listener and there is not fileno defined in that context so I'm getting an exception:

AttributeError: 'NoneType' object has no attribute 'fileno'

https://github.com/AcademySoftwareFoundation/rez/blob/89686626c37e68391c61a5e7a55c9490984f933b/src/rez/utils/execution.py#L67

If fixed it on my end by adding yet another try...except AttributeError around the second call to sys.__stdin__:

                try:
                    file_no = sys.__stdin__.fileno()
                except AttributeError:
                    file_no = None

Cheers,

Thomas

JeanChristopheMorinPerso commented 1 year ago

Thanks @KelSolaar ! I'm curious, what is sys.__stdin__ set to? It's clearly set to something from what I see right? Else that block woudn't be exeuted because the if statement checks if sys.__stdin__ is not None... Generally speaking, I think __stdin__ is expected to be a file like object, so maybe the issue could also be reported to Unreal devs? I think we have some Unreal devs in ASWF...

KelSolaar commented 1 year ago

Yeah it is set to None, I can ask on UDN too.

KelSolaar commented 1 year ago

https://udn.unrealengine.com/s/question/0D54z00008osjsBCAQ/calling-a-python-script-that-access-sysstdinfileno-from-switchboardlistener-raises-an-exception

KelSolaar commented 1 year ago

Epic has patched Switchboard Listener: https://github.com/EpicGames/UnrealEngine/commit/8705ef5a4a889f4b3c7c02016bb0e5a1af932c4a

Let's close this one!

JeanChristopheMorinPerso commented 1 year ago

Thanks for the update! I'm happy they fixed their stuff.