Python 3 minor irritation
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Thu Feb 4 01:27:16 EST 2010
En Thu, 04 Feb 2010 02:46:45 -0300, Alf P. Steinbach <alfps at start.no>
escribió:
> Oh sorry, now I see what you mean. I read it too literally. You mean
> that at script startup __file__ is a valid relative or absolute path to
> the script.
>
> But anyways, Windows Explorer doesn't change the current directory to
> that of the associated program, at least not in Windows XP.
But the associated program might change the current directory - that's not
the case with the default associations created by the Python installer,
but one should verify this.
To the OP: please create this small test script
import os
print("curdir=", os.getcwd())
print("__file__=", __file__)
input()
and post what you get when you double-click on it.
Also, from the command line, execute:
D:\temp>reg query HKCR\.py
! REG.EXE VERSION 3.0
HKEY_CLASSES_ROOT\.py
<Sin nombre> REG_SZ Python.File
Content Type REG_SZ text/plain
HKEY_CLASSES_ROOT\.py\PersistentHandler
D:\temp>reg query HKCR\Python.File\shell\open\command
! REG.EXE VERSION 3.0
HKEY_CLASSES_ROOT\Python.File\shell\open\command
<Sin nombre> REG_SZ "D:\Apps\Python26\python.exe" "%1" %*
The first command says that files ending with .py are of type
"Python.File", the second one says which command is executed to open a
"Python.File" file.
--
Gabriel Genellina
More information about the Python-list
mailing list