python current path function?

  • From: "Alex Hall" <mehgcap@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 18 Jan 2010 06:51:31 -0500

Hi all,
I am trying to point python to the currently running script's directory so it can find an ini file there. I was told to use
ini=os.path.join(sys.argv[0],'name.ini')
but that returns the name.ini filename attached to the full path, including the script name:
c:\path\file.pyw\file.ini

I want just the path to the script, not the script itself. Also, I think I need it as a raw string or with double backslashes. How do I do this? Thanks!


Have a great day,
Alex
Email: mehgcap@xxxxxxxxx
__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: