Job Fails to Start Due to Python Syntax Error

General discussions and questions.
Post Reply
Anti-Distinctlyminty
Posts: 23
Joined: Sat Jan 08, 2022 4:15 pm

Job Fails to Start Due to Python Syntax Error

Post by Anti-Distinctlyminty »

I am attempting to use afstarter to submit a generic command line job so we can quickly integrate an older piece of software into our farm (LightWave3D), but I'm getting some very strange errors.

I have configured the settings that result in the following

Code: Select all

"python" "C:\ProgramData\Rez\cache\cgru\3.3.0-b75c1cb\0368\a\cgru\afanasy\python\afjob.py" "T:\__TO_BE_DELETED\CGRU_Lightwave\scenes\lightwave_test.lws" 1 10 -by 1 -fpt 1 -seq 1 -extrargs "-3 T:\__TO_BE_DELETED\CGRU_Lightwave\scenes\lightwave_test.lws" -os any -pwd "T:\__TO_BE_DELETED\CGRU_Lightwave\scenes" -name "lightwave_test.lws" -exec "T:\__LightwaveFarm\Lightwave2020.0.3\bin\lwsn.exe"
Which submits successfully and attempts to render. However, during a render attempt I get the following output:

Code: Select all

LightWave AMD64 ScreamerNet Module (Build 3227)
CPU number: 862

  File "C:\ProgramData\Rez\cache\cgru\3.3.0-b75c1cb\0368\a\cgru\python\lib\site.py", line 178
    file=sys.stderr)
        ^
SyntaxError: invalid syntax
Now, the correct executable seems to be starting (lwsn.exe) indicated by the text "LightWave AMD64 ScreamerNet Module (Build 3227)", but then after that we get the Python syntax error. My guess is that the Python embedded in lwsn.exe is too old but is picking up some environment variable or sys.path and trying to scan teh cgru python code which is too new.

Any ideas on how to circumvent this?
Anti-Distinctlyminty
Posts: 23
Joined: Sat Jan 08, 2022 4:15 pm

Re: Job Fails to Start Due to Python Syntax Error

Post by Anti-Distinctlyminty »

It seems to be caused by the PYTHONHOME environment variable that is set by setup.cmd being inherited by the executed command.
Is there any mechanism to prevent this environment variable (or all environment variables) being inherited?
User avatar
timurhai
Site Admin
Posts: 916
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

Re: Job Fails to Start Due to Python Syntax Error

Post by timurhai »

Yes, your software tries to use CGRU Python, but should use own older version.
You should empty PYTHONHOME variable:

Code: Select all

set PYTHONHOME=
CGRU software setup do this for all soft:
https://github.com/CGRU/cgru/blob/maste ... p__all.cmd

You should make a cmd script wrapper to make your soft not to launch directly, but after some environment turning.
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
Anti-Distinctlyminty
Posts: 23
Joined: Sat Jan 08, 2022 4:15 pm

Re: Job Fails to Start Due to Python Syntax Error

Post by Anti-Distinctlyminty »

Hi Timur,
I'll look into this further, thank you.
Post Reply