Running executable from python

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Running executable from python

Mark
Hi everybody,

I am trying to run an executable compiled from c++ using python console in
Slicer on Ubuntu. I tried os.system and os.subprocess, but I either get 0 or
nothing in return when I use a precompiled version of Slicer or Slicer just
exits if I use a compiled form source versio with USE_SYSTEM_PYTHON=1.

Both functions work in python in terminal.

A while ago I also had Slicer on my mac and I could run executables if I
opened Slicer with sudo, but this doesn't work on Ubuntu.

Thank you



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Running-executable-from-python-tp4038250.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Running executable from python

Steve Pieper-2
Hi Mark - 

When you run the Slicer command it is actually the launcher [1] setting up all the paths and environment variables it needs to resolve to the correct versions of libraries that the real application (bin/SlicerApp-real) needs.  So probably that isn't what your executable expects.  You could compile your executable in static mode to insulate it from the environment or you could set up a launcher that makes sure it gets the correct paths.

HTH,
Steve


On Sat, Mar 11, 2017 at 11:04 AM, Mark <[hidden email]> wrote:
Hi everybody,

I am trying to run an executable compiled from c++ using python console in
Slicer on Ubuntu. I tried os.system and os.subprocess, but I either get 0 or
nothing in return when I use a precompiled version of Slicer or Slicer just
exits if I use a compiled form source versio with USE_SYSTEM_PYTHON=1.

Both functions work in python in terminal.

A while ago I also had Slicer on my mac and I could run executables if I
opened Slicer with sudo, but this doesn't work on Ubuntu.

Thank you



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Running-executable-from-python-tp4038250.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ


_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Running executable from python

Mark
Hi Steve,

Thank you! Compiling executables in static mode helped.



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/Running-executable-from-python-tp4038251p4038265.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|

Re: Running executable from python

Mark
This post has NOT been accepted by the mailing list yet.
In reply to this post by Steve Pieper-2
Hi Steve,

Thank you! Compiling executables in static mode helped.