Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows System Error #4

Open
mankoff opened this issue Jun 11, 2018 · 1 comment
Open

Windows System Error #4

mankoff opened this issue Jun 11, 2018 · 1 comment

Comments

@mankoff
Copy link

mankoff commented Jun 11, 2018

I'm trying to use your wonderful code on Windows but getting a System Error:

g.list.exe - System Error
The code execution cannot proceed because libgrass_vector.7.4.0.dll was not found.
Reinstalling the program may fix this problem.

This is caused from the following script. Everything works until the last g.list line:

grass7bin = r'"C:\Program Files\GRASS GIS 7.4.0\grass74.bat"'
import os
os.environ['GRASSBIN'] = grass7bin

from grass_session import Session
from grass.pygrass.modules.shortcuts import general as g

PERMANENT=Session()
PERMANENT.open(gisdb="C:\Users\<user>\Documents\GRASS_database", location="G", mapset="PERMANENT", create_opts="")

g.list(type="raster")

I'm running this from within IPython inside Spyder. The same (rough) code works when I do it on OS X.

@zarch
Copy link
Owner

zarch commented Apr 12, 2019

Hi @mankoff,
sorry for the silence... it has been a busy period... :-P

Unfortunatelly, I have not chance to test the code on a windows machine, but from the error that you provide, it seems like windows don't know in which directory can find the grass ddls. Probably the error is due to a wrong environmental variable setting up the path.

If you open in a grass shell a python interpreter and execute the following lines:

import os
for key in sorted(os.environ.keys()): 
    print("{} => {}".format(key, os.environ[key]))

Then execute the same line within the grass-session, so for instance:

grass7bin = r'"C:\Program Files\GRASS GIS 7.4.0\grass74.bat"'
import os
os.environ['GRASSBIN'] = grass7bin

from grass_session import Session
from grass.pygrass.modules.shortcuts import general as g

PERMANENT=Session()
PERMANENT.open(gisdb="C:\Users\<user>\Documents\GRASS_database", location="G", mapset="PERMANENT", create_opts="")

for key in sorted(os.environ.keys()): 
    print("{} => {}".format(key, os.environ[key]))

Using a difftool (e.g. meld) or just comparing the outputs you should be able to identify which environmental variable is not set correctly or which relevant environmental variable is missing.
If you can provide to me the information of what is not correct I would glad to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants