[GRASS-user] Problems with GRASS python code in osgeo4w
Moskovitz, Bob
Bob.Moskovitz at conservation.ca.gov
Thu Jul 9 13:50:41 EDT 2009
Glynn Clements 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" %*
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
Bob Moskovitz
Research Analyst I
Seismic Hazard Evaluation Project
California Geological Survey
http://gmw.consrv.ca.gov/shmp
CONFIDENTIALITY NOTICE: This communication is intended only for the use of the individual or entity to which it is addressed. This message contains information from the State of California, California Geological Survey, which may be privileged, confidential and exempt from disclosure under applicable law, including the Electronic Communications Privacy Act. If the reader of this communication is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited.
More information about the grass-user
mailing list