Load file on launch?

55 views
Skip to first unread message

BrenBarn

unread,
Nov 22, 2010, 3:12:51 AM11/22/10
to DreamPie
Hi. DreamPie looks like it might be useful to me, except that it
seems to be missing one of the most basic features: the ability to
load a python file on startup. With IDLE I can use the -r command
line switch to specify a file to be loaded at startup; IDLE then drops
into an environment where everything in that file has already run, so
my data is pre-loaded and ready to play with interactively.

Isn't there a way to do this with DreamPie? I want to be able to do
something like

dreampie --hide-console-window "C:\Path\to\python.exe" "C:\Path\to\my
\program.py"

and have it run program.py and deposit me in the interactive window
after doing so.

Thanks.

Noam Yorav-Raphael

unread,
Nov 22, 2010, 3:17:32 AM11/22/10
to drea...@googlegroups.com
Hello,

There is no command-line option to do that, but you can set any code
to be run at startup, in Edit->Preferences->Shell.

You can of course run "execfile(filename)" in the beginning of your
session. I think it should work just as well as a command line option.

Noam

BrenBarn

unread,
Nov 22, 2010, 3:21:12 AM11/22/10
to DreamPie
On Nov 22, 12:17 am, Noam Yorav-Raphael <noamr...@gmail.com> wrote:
> Hello,
>
> There is no command-line option to do that, but you can set any code
> to be run at startup, in Edit->Preferences->Shell.
>
> You can of course run "execfile(filename)" in the beginning of your
> session. I think it should work just as well as a command line option.

I saw that option, but neither that nor execfile is adequate. The
"set code to run on startup" is obviously not a general solution,
since I don't want to set one global block of code to always run; I
want to specify at each launch which code to run.

The key thing is that I want to be able to call dreampie from a text
editor that lets me use a "run" option -- that is, use it instead of
the regular python interpreter (or IDLE) to run my code. I can only
do that if I can specify code to run on a per-use basis.

Thanks.

Noam Yorav-Raphael

unread,
Nov 26, 2010, 5:08:27 AM11/26/10
to drea...@googlegroups.com
Ok, now I understand the use case.

I usually just switch to an already running instance, and run there the script using "execfile" (I type "ex" and the ctrl-up, which retrieves the last "execfile" command.)

Anyway, I added this to revision 207 in bzr - just add "--run filename" to the command line.

Noam

BrenBarn

unread,
Dec 1, 2010, 4:29:30 PM12/1/10
to DreamPie
Cool, thanks. (I haven't been able to use feature yet, unfortunately,
since I can't seem to get GTK working, so I can't use DreamPie except
from the binary installer.)

Noam Yorav-Raphael

unread,
Dec 1, 2010, 10:54:23 PM12/1/10
to drea...@googlegroups.com
Try to put the gtk-runtime and pygtk-2.6 directories from the binary install into the source directory. It should work then.
Reply all
Reply to author
Forward
0 new messages