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

Fix cfunits import error on Windows #84

Merged
merged 2 commits into from
May 14, 2019

Conversation

mcflugen
Copy link
Member

This fixes an issue on Windows where the units database could not be found (udunits2.xml). This resulted as an assertion error when importing cfunits from within pymt,

>>> import cfunits
Traceback (most recent call last):
...
    assert(0 == _ut_unmap_symbol_to_unit(_ut_system, _c_char_p(b'Sv'), _UT_ASCII))

The issue is that udunits2 library can not correctly find udunits2.xml in the default location. On Windows anyway. To fix this, I set the UDUNITS_XML_PATH environment variable in pymt/__init__.py to point to the path of udunits2.xml within the cfunits package. I do this for all platforms, not just Windows but I think that should be fine.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 71.379% when pulling b583c44 on mcflugen/fix-cfunits-import-error-on-windows into cd191be on master.

@mcflugen mcflugen merged commit 2cf21cc into master May 14, 2019
@mcflugen mcflugen deleted the mcflugen/fix-cfunits-import-error-on-windows branch May 14, 2019 17:54
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

Successfully merging this pull request may close these issues.

2 participants