'Maya python subprocess error "subprocess.py line 555: argument of type 'NoneType' is not iterable"
I'm currently trying to get a script to work which should batch export some assets and also render a preview for these. The DCC is maya and the renderengine is redshift. Language is python The script works fine as long as I export one Asset at a time but I cannot pass on multiple asset since the render one rendering process will still run while the next one is trying to be started thus ending the script. I also tried using a subprocess which doesn't work for some reason.
Code:
import subprocess
import RSL_Script_Package.PreviewRender as PreviewRender
subprocess.run([PreviewRender.renderPreview(r"M:\Test","test")],capture_output=True)
print(process)
Output:
! Initiate preview render...
['pCube4']
# Error: TypeError: file G:\Autodesk\Maya2022\Python37\lib\subprocess.py line 555: argument of type 'NoneType' is not iterable #
// Info: [Redshift] Redshift for Maya 2022 //
// Info: [Redshift] Version 3.0.56, Sep 11 2021 //
// Info: [Redshift] Rendering frame 1 (1/1) //
// Info: [Redshift] Scene translation time: 0.02s //
// Info: [Redshift] ================================================================================================= //
// Info: [Redshift] Rendering frame 1... //
// Info: [Redshift] AMM enabled //
// Info: [Redshift] ================================================================================================= //
// Info: [Redshift] License acquired //
// Info: [Redshift] License for redshift-core 2021.09 (permanent) //
// Info: [Redshift] //
// Info: [Redshift] Device 0 (NVIDIA GeForce RTX 3090) uses OptiX for ray tracing //
// Info: [Redshift] //
// Info: [Redshift] Rendering time: 6.1s (1 GPU(s) used) //
// Info: [Redshift] Saved file 'M:\Test\test_Preview.png' in 0.22s //
// Info: [Redshift] Frame done - total time for frame 1 (1/1): 6.98s //
// Info: [Redshift] Rendering done - total time for 1 frames: 7.02s //
// Info: [Redshift] License returned //
When using another function like "dir" it would give me a proper result as seen here:
Code:
import subprocess
import RSL_Script_Package.PreviewRender as PreviewRender
subprocess.run(["dir"], shell=True ,capture_output=True)
print(process)
Output:
CompletedProcess(args=['dir'], returncode=0)
I guess it has something to do with this error:
# Error: TypeError: file G:\Autodesk\Maya2022\Python37\lib\subprocess.py line 555: argument of type 'NoneType' is not iterable #
But I have no idea why it happens.
Please help :D
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
