Can Python Module Locate Itself?

netytan member39949 at dbforums.com
Wed Sep 17 05:58:07 EDT 2003


You can use sys.argv[0] to get the path of the program and use that to
read in the program file.. you could then parse the source as usual.



But personally i'd be enclined to go with Juha's idea, it seems more
elegant and requires less work on the part of the program and the
programmer..



Have fun,

Mark.


--
Posted via http://dbforums.com




More information about the Python-list mailing list