Message 1 of 15
Unable to launch application on Mac with subprocess.Popen (Python)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Here is a script that should launch some applications on Mac:
import subprocess
import os
fileName = '/Users/jeromebriot/Desktop/Body1.stl'
# Cura
apps = ('/Applications/Ultimaker Cura.app',
'/Applications/Meshmixer.app',
'/Applications/meshlab.app',
'/Applications/PreForm.app',
'/Applications/SlicerForFusion360.app')
exe = ('cura',
'meshmixer',
'meshlab',
'PreForm',
'SlicerForFusion360')
for i in range(0, len(apps)):
fullPath = os.path.join(apps[i], 'Contents', 'MacOS', exe[i])
if os.path.exists(fullPath):
subprocess.Popen([fullPath, fileName])
# subprocess.Popen(['open', apps[i]])
else:
print('{} not found.'.format(exe[i]))The basic idea is to mimic the "Send to 3D utility" of the 3D print tool.
The code works perfectly inside a terminal but it fails when run inside Spyder (and in my add-in).
For some applications, I receive a message like "The app quit unexpectedly"
Any idea?
Jérôme Briot, Freelance engineer - Mechanical design and prototyping
3D Print Plus / Pro | IDF Import | GitHub To Fusion 360 | Tube Bending Data Exchanger | Slice Data Export
Memory Used | Basic Calculator | Check Computer Specifications | Import spline from any CSV file