Moskovitz, Bob wrote: > > 1. Ensure that .py files are configured to be run with the Python > > interpreter. You should be able to double-click on a .py file in > > Explorer and have it run. This should be done by the Python installer, > > but I don't know if the OSGeo4W installer does this. > > > > If it isn't, you can use e.g.: > > > > assoc .py=python.file > > ftype python.file="C:\Program Files\Python25\python.exe" "%1" > > > > [Change the pathname to wherever Python is installed.] > > I just wanted to update you on my progress with this problem. I still > can't get my script to work, but I believe I know the cause of the > problem. As you can see below I've included an email you sent related > to setting up python file association. > > BTW, I did file an osgeo4w ticket: > http://trac.osgeo.org/osgeo4w/ticket/95 > > After looking at the ftype help, it looks like I should have issued the > command: > ftype python.file="C:\Program Files\Python25\python.exe" "%1" %*
You don't need the trailing %*. You do need a corresponding "assoc" command. > I've done that, but I still have the same problem. I created a simple > test program that just prints out the scripts arguments: > > # printargs.py ############ > import sys > > for arg in sys.argv: > print arg > ########################### > > And here is grass session that illustration the problem: > > GRASS 6.4.0svn (Morgan_Hill)> assoc .py > .py=py_auto_file > > GRASS 6.4.0svn (Morgan_Hill)> ftype py_auto_file > py_auto_file="C:\OSGeo4W\bin\python.exe" "%1" %* > > GRASS 6.4.0svn (Morgan_Hill)> C:\Temp\printargs.py this is a test > C:\Temp\printargs.py > > GRASS 6.4.0svn (Morgan_Hill)> python C:\Temp\printargs.py this is a test > C:\Temp\printargs.py > this > is > a > test Okay, so Python is working fine. There have been some bugs fixed recently regarding g.parser on Windows. The first thing to check with a GRASS script is that "script --help" generates the help message. If it doesn't, that indicates that either g.parser isn't being called or it isn't being passed the script's filename correctly. If --help works but invoking the script with other arguments doesn't work, that indicates that g.parser is failing to re-invoke the script. If the script requires arguments, running the script without arguments should bring up the GUI. Some bugs with this were fixed quite recently, but I don't know if others remain. -- Glynn Clements <[email protected]> _______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
