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 paths are not handled properly #147

Closed
CasperWA opened this issue Apr 21, 2021 · 3 comments
Closed

Windows paths are not handled properly #147

CasperWA opened this issue Apr 21, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@CasperWA
Copy link
Contributor

CasperWA commented Apr 21, 2021

From CIF-ontology, I tried to run generate_cif.py locally on my Windows 10 environment with Python 3.8.

First, an issue arised with Windows paths for the PyCIFRW dependency, which has been reported and subsequently fixed.
When running the script now, it fails for similar reasons (Windows path handling) via the this dependency, specifically in the line self.top = self.world.get_ontology(cif_top).load(), where self.world = emmo.World().

Full traceback:

C:\Users\c_w_a\Documents\GitHub\CIF-ontology\cif_top.ttl does not look like a valid URI, trying to serialize this will break.
Traceback (most recent call last):
  File ".\dic2owl\dic2owl\generate_cif.py", line 211, in <module>
    self = gen = main()
  File ".\dic2owl\dic2owl\generate_cif.py", line 191, in main
    gen = Generator(dicfile="cif_core.dic", base_iri=base_iri)
    self.top = self.world.get_ontology(cif_top).load()
  File "C:\Users\c_w_a\.virtualenvs\EMMO\lib\site-packages\emmo\ontology.py", line 295, in load
    self._load(only_local=only_local, filename=filename, format=format,
  File "C:\Users\c_w_a\.virtualenvs\EMMO\lib\site-packages\emmo\ontology.py", line 397, in _load
    g.parse(resolved_url, format=fmt)
  File "C:\Users\c_w_a\.virtualenvs\EMMO\lib\site-packages\rdflib\graph.py", line 1062, in parse
    source = create_input_source(
  File "C:\Users\c_w_a\.virtualenvs\EMMO\lib\site-packages\rdflib\parser.py", line 193, in create_input_source
    input_source = URLInputSource(absolute_location, format)
  File "C:\Users\c_w_a\.virtualenvs\EMMO\lib\site-packages\rdflib\parser.py", line 113, in __init__
    file = urlopen(req)
  File "C:\Users\c_w_a\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Users\c_w_a\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 525, in open
    response = self._open(req, data)
  File "C:\Users\c_w_a\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 547, in _open
    return self._call_chain(self.handle_open, 'unknown',
  File "C:\Users\c_w_a\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 502, in _call_chain
    result = func(*args)
  File "C:\Users\c_w_a\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 1390, in unknown_open
    raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: c>

My setup:
Windows 10 (version 20H2, build 19042.928)
Python 3.8.1
Virtual environment through virtualenvironment-powershell.
Installed EMMO from PyPI (version 1.0.0)

While I normally use WSL 2.0 (Linux kernel in Windows), I would prefer not to for this particular project.

@CasperWA CasperWA added the bug Something isn't working label Apr 21, 2021
@CasperWA
Copy link
Contributor Author

Actually, it looks like the issue is the rdflib package.

@CasperWA
Copy link
Contributor Author

Hmm, it might be my fault for working in the branch, where I moved stuff around and the fact that the script expects the ontology files to be present alongside it.

@CasperWA
Copy link
Contributor Author

Hmm, it might be my fault for working in the branch, where I moved stuff around and the fact that the script expects the ontology files to be present alongside it.

Indeed. This could all be fixed from the side of the script using EMMO-Python, i.e., it should be fine on this side. I will therefore close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant