Permissions Error: Within a python script, I need to find a server file in unix system and open it to run commands for the user -
in unix system, within python script, trying open terminal window , start server. understanding python has subprocess module supposed allow such thing. so:
import subprocess subprocess.popen(['path terminal'])
returns:
oserror: [errno 13] permission denied
how run right permissions? or, there better, secure way need?
i'm relatively new programming, please reorient discussion if question misguided. thank you!
edit: state execute /applications/utilities/terminal.app
, apparently running mac os x.
mac os x .app programs are directories. can started mac os shell command open
.
to open program /path/to/server in fresh max os terminal session:
import subprocess termapp=['open','-a','/applications/utilities/terminal.app'] sp=subprocess.popen(termapp+['/path/to/server'])
there's shell-command version of terminal, not need open -a
.
import subprocess termapp=['/applications/utilities/terminal.app/contents/macos/terminal'] sp=subprocess.popen(termapp+['/path/to/server'])
the 2 ways have subtle differences in how windows grouped window manager. each time above terminal process , icon in tray. while -a new window opened within same terminal main program.
Comments
Post a Comment