[slicer-users] using python out of Slicer3 python console

Demian Wassermann demian at bwh.harvard.edu
Fri Jun 4 01:15:18 EDT 2010

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  
      scene after --exec)

Hope that helps

Demian Wassermann, PhD
demian at bwh.harvard.edu
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
> slicer-users at bwh.harvard.edu
> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
> To unsubscribe: send email to slicer-users- 
> request at massmail.spl.harvard.edu with unsubscribe as the subject

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://massmail.spl.harvard.edu/pipermail/slicer-users/attachments/20100604/071a0e76/attachment.html>

More information about the slicer-users mailing list