Re: [Tutor] querying the name of a calling python file

2010-11-05 Thread Alan Gauld
"Garry Willgoose" wrote For a while now I have been using the command below in a python file to determine the name of the python file that I use to launch an application sys.modules['__main__'].__dict__['__file__'] The usual way to do that would be via sys.argv[0] Is there any reason why

Re: [Tutor] querying the name of a calling python file

2010-11-05 Thread शंतनू
On 05-Nov-2010, at 4:45 PM, Garry Willgoose wrote: > For a while now I have been using the command below in a python file to > determine the name of the python file that I use to launch an application > (i.e.IF I go 'python junk.py' I want to get 'junk.py'). The command I have > use that I cam

[Tutor] querying the name of a calling python file

2010-11-05 Thread Garry Willgoose
For a while now I have been using the command below in a python file to determine the name of the python file that I use to launch an application (i.e.IF I go 'python junk.py' I want to get 'junk.py'). The command I have use that I came across somewhere some time ago was sys.modules['__main__']