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

[Review] Example for pyromat.info() in docs does not work #55

Closed
espottesmith opened this issue Sep 22, 2022 · 1 comment · Fixed by #57
Closed

[Review] Example for pyromat.info() in docs does not work #55

espottesmith opened this issue Sep 22, 2022 · 1 comment · Fixed by #57

Comments

@espottesmith
Copy link

In the README, the following example is given:

>>> import pyromat as pm
>>> O2 = pm.get('ig.O2')
>>> h = O2.h(492,1.01)  # enthalpy at 492K, 1.01bar
>>> pm.info('O2')     # where did these data come from?
>>> pm.config['unit_pressure'] = 'psi'  # Don't like working in bar?

However, attempting the info() function with pyromat 2.2.1, I get an error:

PM ERR: No substanced named "O2" was found in the loaded data.
---------------------------------------------------------------------------
PMParamError                              Traceback (most recent call last)
Input In [19], in <cell line: 1>()
----> 1 pm.info('O2')

File ~/miniconda3/envs/romat/lib/python3.9/site-packages/pyromat/__init__.py:275, in info(members, target, **kwarg)
    273     members = [members]
    274 elif isinstance(members, str):
--> 275     members = [get(members)]
    277 # If operating verbosely, we'll need to print to stdout
    278 if target is None:

File ~/miniconda3/envs/romat/lib/python3.9/site-packages/pyromat/__init__.py:81, in get(idstr)
     79 if out is None:
     80     utility.print_error('No substanced named "' + str(idstr) + '" was found in the loaded data.')
---> 81     raise utility.PMParamError('Invalid substance ID string')
     82 return out

PMParamError: Invalid substance ID string

This is resolved if the phase is included (i.e. by running pm.info("ig.O2")).

Please change the README to reflect proper usage of the info() function, or else change info() to enable functionality without specifying phase information.

@espottesmith espottesmith changed the title Example for pyromat.info() in docs does not work [Review] Example for pyromat.info() in docs does not work Sep 22, 2022
@chmarti1
Copy link
Owner

Thanks for the heads-up. v2.2.0 changed the behavior of info() and I forgot to update the README to reflect the new UI. Good catch.

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

Successfully merging a pull request may close this issue.

2 participants