[IronPython] Startup scripts

Michael Foord fuzzyman at voidspace.org.uk
Fri Nov 28 22:53:16 CET 2008


Richard Bowen wrote:
>  
> thanks. I knew about site.py, but it wont work for me as don't want to 
> touch peoples global library, and I have lots of different versions of 
> the lib on any one box, installed by xcopy.
>  
> Is there any other way?
>  

To be honest your needs are pretty custom. site.py *is* the mechanism 
that Python provides for that kind of situation. Why not create a custom 
executable (instead of ipy.exe) that does what you need?

Michael Foord

> Richard
>
>
>  
> On Fri, Nov 28, 2008 at 2:48 AM, Curt Hagenlocher 
> <curt at hagenlocher.org <mailto:curt at hagenlocher.org>> wrote:
>
>     The Python standard is to use "site.py" to load custom startup
>     code; this file is run automatically at startup.  It's located in
>     the Lib subdirectory of the directory containing the interpreter
>     exe.  This works under both CPython and IronPython.
>
>     On Thu, Nov 27, 2008 at 1:22 PM, Richard Bowen <toolsack at gmail.com
>     <mailto:toolsack at gmail.com>> wrote:
>
>         Hi
>
>         I have a simple question that I'm hoping has an answer I'm
>         looking for. I'd
>         like to have a startup script to seamlessly run before running a
>         specified script.
>
>         Eg I can have a script/module that defines foo() and call on
>         startup
>
>         IRONPYTHONSTARTUP=start.py
>
>         then when I run ipy I can call foo() straight on the command line.
>
>         However when running a command or script I have to re-import
>         the module:
>
>         ipy.exe  -c "import start; from start import *;foo()"
>
>         what I'd like to be able to do is:
>
>         ipy.exe -c "foo()"
>
>         is that possible? (I have a .bat file that makes it work, but
>         I'd like
>         to avoid if possible)
>
>         thanks
>
>         Richard
>          
>
>         _______________________________________________
>         Users mailing list
>         Users at lists.ironpython.com <mailto:Users at lists.ironpython.com>
>         http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
>     _______________________________________________
>     Users mailing list
>     Users at lists.ironpython.com <mailto:Users at lists.ironpython.com>
>     http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog





More information about the Ironpython-users mailing list