What code do you execute on startup?

9 views
Skip to first unread message

Nikola

unread,
Oct 6, 2010, 4:12:34 AM10/6/10
to DreamPie
Dreampie provides you a way to execute your own code on (re)start - in
the Shell tab of the Preferences dialog. What do you have there?

I wanted to load some code that depends on __file__ global that
execfile doesn't set. So I put there:

_execfile=execfile
def my_execfile(fn):
_execfile(fn, {'__file__':fn})
execfile=my_execfile

Nikola

unread,
Oct 6, 2010, 7:11:55 AM10/6/10
to DreamPie
Actually, this works better because it doesn't lose the context where
the execution happens:

_execfile=execfile
def my_execfile(fn):
g = globals()
g['__file__']=fn
_execfile(fn, g)
execfile=my_execfile
Reply all
Reply to author
Forward
0 new messages