Converting a hex string to a number
Matt Gerrans
mgerrans at mindspring.com
Wed Jul 10 13:30:05 EDT 2002
Excellent explanation -- thanks!
I wrote a simple little DOS/Python shell a while back that allowed me to
keep Python loaded and run any script like a normal command (using execfile)
or any DOS command -- it was quite useful on my laptop, epecially combined
with a simple make (Python) script for a Java project. With this
combination and using Jikes, it beat the pants off ANT for performance.
I was doing this:
def runScript(filename):
namespace = { '__name__' : '__main__' }
execfile(filename, namespace)
return namespace
Which was suggested to me by someone in this group. Now I see it is
setting up an almost empty dictionary for the called script -- just the
__name__=='__main__' so it will think it was being called from the command
line.
More information about the Python-list
mailing list