[GRASS-user] Problems with GRASS python code in osgeo4w

Hamish hamish_b at yahoo.com
Mon Jul 13 21:59:51 EDT 2009


> > > Okay, so Python is working fine.
Bob wrote:
> > If python is working, can you explain why my first example
> > ( C:\Temp\printargs.py this is a test ) only prints out sys.argv[0]
> > ?

Glynn:
> Sorry, I overlooked that one.
> 
> > I believe that my problem has nothing to do with g.parser. I
> > believe that the arguments to a python script are being stripped
> > when you rely on ftype.
> 
> Okay; I think I know what's going on.
> 
> It appears that assoc and ftype set the registry keys:
> 
>     HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.py
>     HKEY_LOCAL_MACHINE\SOFTWARE\Classes\python.file\Shell\Open\Command
> 
> [or py_auto_file, if that's what you use.]
> 
> The shell uses:
> 
>     HKEY_CLASSES_ROOT\.py
>     HKEY_CLASSES_ROOT\Python.File\shell\open\command
> 
> which are "virtual" keys which refer to either:
> 
>     HKEY_CURRENT_USER\Software\Classes\Python.File\shell\open\command
>     HKEY_CURRENT_USER\Software\Classes\.py
> 
> or the above HKLM keys, with the HKCU versions taking
> precedence. So you can't use assoc/ftype to change the file
> associations if the HKCU keys exist.
> 
> The confusion arose because both sets of keys were set to
> exactly the same thing on my system.
> 
> FWIW, you do need the %* at the end of the command. If I
> remove that from the HKCU keys, the arguments cease to be passed.


just to note that the osgeo4w build is >2 months out of date now,
and the version that is shipping does not include the .py association
PATHEXT (etc.) and PATH fixes to lib/init/init.bat (etc.)

so this may be fighting battles already fought.


Hamish



      



More information about the grass-user mailing list