subprocess.run unable to run external script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear Fusion-community
We are currently trying to run a custom external python 3.5 script from a Fusion script. For that we use subprocess.run method.
In a normal python environment the command works perfectly fine and produce the following output:
>>> import subprocess
>>> subprocess.run(['/Users/Dani/Development/ALPA_Ordering/localpy_3.5/bin/python', '/Users/Dani/Development/ALPA_Ordering/smartsheet_import.py'], stdout=subprocess.PIPE)
CompletedProcess(args=['/Users/Dani/Development/ALPA_Ordering/localpy_3.5/bin/python', '/Users/Dani/Development/ALPA_Ordering/smartsheet_import.py'], returncode=0, stdout=b"{'_orderName': '15_05_2018_OleOle', '_Prozess': 'Formiga 100\xc2\xb5m', '_export': '', '_filepathPNG': '/Users/Dani/Desktop/STL_Export/2018_05_15_15_05_2018_OleOle', '_Lieferant': '', '_Kommentar': '', '_KTI': False, '_Oberflaeche': 'unbehandelt', '_Typ': 'AM Prototyp', '_boundingBox': 17.999999999999993, '_SelectionVolume': 4.075783958277259, '_filepathSTL': '/Users/Dani/Desktop/STL_Export/15_05_2018_OleOle.stl', '_Versanddatum': '11-12-2018', '_Farbe': 'unbehandelt', '_filepathSTP': '/Users/Dani/Desktop/STL_Export/2018_05_15_15_05_2018_OleOle.stp', '_Selection': 'K\xc3\xb6rper', '_Projekt': '1.1 Platon', '_Material': 'PA 2200', '_Quotation': 5.91, '_Anzahl': 1, '_Ausrichtung': 'Eingabe der Orientierung im Bauraum'}\nReached End\n")By running the exact same command in the Fusion script, the script does not do what it is supposed to do and the following output appears:
>>> import subprocess >>> subprocess.run(['/Users/Dani/Development/ALPA_Ordering/localpy_3.5/bin/python', '/Users/Dani/Development/ALPA_Ordering/smartsheet_import.py'], stdout=subprocess.PIPE) CompletedProcess(args=['/Users/Dani/Development/ALPA_Ordering/localpy_3.5/bin/python', '/Users/Dani/Development/ALPA_Ordering/smartsheet_import.py'], returncode=1, stdout=b'')
How can we execute this external script from a Fusion script? Does have an idea what could have gone wrong here?
PS: We use absolut path to call the script and the directly has 777 permissions. We are on Mac.
We tried also os.sys method, subprocess.check_output method, but they are not running either.
Thanks a lot in advance for your support. We're really running out of ideas.
Best,
Daniel
