using python out of Slicer3 python console

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

using python out of Slicer3 python console

Joohwi Lee
Hi, all,

Is there a way to load Slicer module out of Slicer3 python console?
I am trying to set PYTHONPATH as os.environ["PYTHONPATH"] in Slicer3 console,
but when I try to load 'import Slicer', it fails saying that 'module tk not found'.
Could anyone point me how to load Slicer module out of the box?

Thank you,
Joohwi

_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: using python out of Slicer3 python console

Demian Wassermann-2
Hi Joohwi,

actually the answer is "no". The slicer module interacts with the running slicer application which is loaded in memory so it can not be loaded from a python interpreter not associated with the an active instance of the application.

However, if you want to run a script without going through the Slicer GUI you can run it using the Slicer --evalpython "execfile( yourscript.py )"

As it is written in the help

   --execpython <std::string>
     Some Python code to execute after slicer loads. (note: cannot specify
     scene after --exec)

Hope that helps
Demian

--
Demian Wassermann, PhD
LMI / PNL / SPL Labs
Harvard Medical School
Brigham and Women's Hospital
1249 Boylston, Boston, MA, USA

On Jun 4, 2010, at 1:00 AM, Joohwi Lee wrote:

Hi, all,

Is there a way to load Slicer module out of Slicer3 python console?
I am trying to set PYTHONPATH as os.environ["PYTHONPATH"] in Slicer3 console,
but when I try to load 'import Slicer', it fails saying that 'module tk not found'.
Could anyone point me how to load Slicer module out of the box?

Thank you,
Joohwi
_______________________________________________
slicer-users mailing list
To unsubscribe: send email to [hidden email] with unsubscribe as the subject


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject