You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our environment (Windows 10), mappyfile is installed on a mapped network drive. In this case mappyfile cannot find its schema files (*.json) in the schemas subdirectory. The following error message is displayed:
>>> import mappyfile
>>> mapfile = mappyfile.open(r"C:\ProgramData\OEREBK\oerebpruef\oerebpruef\oerebpruef_gemeinde.map")
>>> mappyfile.dumps(mapfile)
Traceback (most recent call last):
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 1503, in open_local_file
stats = os.stat(localfile)
FileNotFoundError: [WinError 3] Das System kann den angegebenen Pfad nicht finden: '\\a2za-cfs-data0.jgk.be.ch\\data0\\GIS02\\Anwend\\Tools\\Python_Module\\Python_Installation\\Python39\\site-packages\\mappyfile\\schemas\\onoff.json'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\jsonref.py", line 130, in callback
base_doc = self.loader(uri)
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\jsonref.py", line 255, in jsonloader
with urlopen(uri) as content:
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 517, in open
response = self._open(req, data)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 534, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 494, in _call_chain
result = func(*args)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 1481, in file_open
return self.open_local_file(req)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\urllib\request.py", line 1520, in open_local_file
raise URLError(exp)
urllib.error.URLError: <urlopen error [WinError 3] Das System kann den angegebenen Pfad nicht finden: '\\a2za-cfs-data0.jgk.be.ch\\data0\\GIS02\\Anwend\\Tools\\Python_Module\\Python_Installation\\Python39\\site-packages\\mappyfile\\schemas\\onoff.json'>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\mappyfile\utils.py", line 414, in dumps
return _pprint(
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\mappyfile\utils.py", line 478, in _pprint
return pp.pprint(d)
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\mappyfile\pprint.py", line 330, in pprint
lines += self._format(composite)
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\mappyfile\pprint.py", line 565, in _format
line = self.process_attribute(
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\mappyfile\pprint.py", line 455, in process_attribute
value = self.format_value(attr, attr_props, value)
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\mappyfile\pprint.py", line 379, in format_value
if any(i in ["enum"] for i in attr_props):
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\proxytypes.py", line 189, in proxied
args.insert(arg_pos, self.__subject__)
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\proxytypes.py", line 163, in __getattribute__
return _oga(self, attr)
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\proxytypes.py", line 121, in wrapper
return method(self, *args, **kwargs)
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\proxytypes.py", line 243, in __subject__
self.cache = super(LazyProxy, self).__subject__
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\proxytypes.py", line 121, in wrapper
return method(self, *args, **kwargs)
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\proxytypes.py", line 227, in __subject__
return self.callback()
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\proxytypes.py", line 121, in wrapper
return method(self, *args, **kwargs)
File "K:\Anwend\Tools\Python_Module\Python_Installation\Python39\site-packages\jsonref.py", line 132, in callback
raise self._error(
jsonref.JsonRefError: Error while resolving `file:///a2za-cfs-data0.jgk.be.ch/data0/GIS02/Anwend/Tools/Python_Module/Python_Installation/Python39/site-packages/mappyfile/schemas/onoff.json`: URLError: <urlopen error [WinError 3] Das System kann den angegebenen Pfad nicht finden: '\\a2za-cfs-data0.jgk.be.ch\\data0\\GIS02\\Anwend\\Tools\\Python_Module\\Python_Installation\\Python39\\site-packages\\mappyfile\\schemas\\onoff.json'>
If mappyfile is installed on a local drive (e.g. C:), the schema files can be found.
As a workaround, I have removed the call to os.path.realpath() in line 71 in validator.py.
@peterschaer - thanks for reporting. Now mappyfile is Python3 only this can probably be rewritten to use a path from the package resources.
In your example above what do the two different calls return?
# current / brokenprint(os.path.join(os.path.dirname(os.path.realpath(__file__)), "schemas"))
# patched / workingprint(os.path.join(os.path.dirname(__file__), "schemas"))
In our environment (Windows 10), mappyfile is installed on a mapped network drive. In this case mappyfile cannot find its schema files (*.json) in the schemas subdirectory. The following error message is displayed:
If mappyfile is installed on a local drive (e.g. C:), the schema files can be found.
As a workaround, I have removed the call to
os.path.realpath()
in line 71 in validator.py.mappyfile/mappyfile/validator.py
Line 71 in dadca20
The schema files are then found.
Environment:
Python 3.9.16
mappyfile 1.0.1
jsonref 1.1.0
jsonschema 4.22.0
The text was updated successfully, but these errors were encountered: