os.path.dirname(sys.argv) always returns nothing
rosuav at gmail.com
Mon Aug 1 19:53:30 CEST 2011
On Mon, Aug 1, 2011 at 6:38 PM, happykid <psyking841 at gmail.com> wrote:
> I want to use this function to get the directory path of the running
> script, but it always returns empty string. Can anyone help me solve
> this? Thank you.
As long as you haven't changed directory since startup, you should be
able to use os.path.abspath(sys.argv) to get the absolute path
name. It'll automatically fill in the path from the current directory
if it's not provided.
More information about the Python-list