AguaClara / aguaclara

An open-source Python package for designing and performing research on AguaClara water treatment plants.
https://aguaclara.github.io/aguaclara/
MIT License
24 stars 13 forks source link

file path is wrong for unit definitions.txt #129

Closed monroews closed 5 years ago

monroews commented 5 years ago

FileNotFoundError Traceback (most recent call last) C:\Users\mw24\Anaconda3\lib\site-packages\pint\registry.py in load_definitions(self, file, is_resource) 359 else: --> 360 with open(file, encoding='utf-8') as fp: 361 return self.load_definitions(fp, is_resource)

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\mw24\Anaconda3\lib\site-packages\aguaclara\core\data/unit_definitions.txt'

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)

in () ----> 1 from aguaclara.play import* C:\Users\mw24\Anaconda3\lib\site-packages\aguaclara\play.py in () 27 28 # Design imports ---> 29 from aguaclara.design.lfom import LFOM 30 31 # Core imports C:\Users\mw24\Anaconda3\lib\site-packages\aguaclara\design\lfom.py in () 1 """Build an Linear Flow Orifice Meter""" ----> 2 from aguaclara.core.units import unit_registry as u 3 import aguaclara.core.constants as con 4 import numpy as np 5 import aguaclara.core.physchem as pc C:\Users\mw24\Anaconda3\lib\site-packages\aguaclara\core\units.py in () 51 pd.options.display.float_format = ('{:,.' + str(n) + '}').format 52 ---> 53 unit_registry.load_definitions(os.path.join(os.path.dirname(__file__), "data/unit_definitions.txt")) C:\Users\mw24\Anaconda3\lib\site-packages\pint\registry.py in load_definitions(self, file, is_resource) 366 except Exception as e: 367 msg = getattr(e, 'message', '') or str(e) --> 368 raise ValueError('While opening {0}\n{1}'.format(file, msg)) 369 370 ifile = SourceIterator(file) ValueError: While opening C:\Users\mw24\Anaconda3\lib\site-packages\aguaclara\core\data/unit_definitions.txt [Errno 2] No such file or directory: 'C:\\Users\\mw24\\Anaconda3\\lib\\site-packages\\aguaclara\\core\\data/unit_definitions.txt'
HannahSi commented 5 years ago

@monroews The code referenced in the error seems to be from release v0.0.14. Are you sure that you are running code from version v0.0.15? You can use pip show aguaclara to check and, if the version is outdated, pip install aguaclara --upgrade to upgrade it.

monroews commented 5 years ago

I ran the pip show aguaclara command and I am using v0.0.15.

Name: aguaclara Version: 0.0.15 Summary: Open source functions for AguaClara water treatment research and plant design. Home-page: https://github.com/AguaClara/aguaclara Author: AguaClara at Cornell Author-email: aguaclara@cornell.edu License: MIT Location: c:\users\mw24\anaconda3\envs\textbook\lib\site-packages Requires: numpy, scipy, pandas, matplotlib, pint Required-by:

HannahSi commented 5 years ago

Problem solved! It turned out that the virtual environment linked to Hydrogen had version 13 of the aguaclara package. from aguaclara.play import * worked perfectly after upgrading to version 15.

fletchapin commented 5 years ago

@HannahSi thanks for figuring this out. I meant to take a look at it a while back but work has been very very busy recently. Feel free to keep assigning me things if you want me to take a look though!

HannahSi commented 5 years ago

@fletchapin No problem, I understand you're very busy! It turned out to be much easier to solve in person (in front of Monroe's computer). But thank you for keeping this on your mind, and I'll continue to keep you in the loop in the future!