KingsburyLab/pyEQL

Error when calculating osmotic pressure - bad operand type for unary -: 'Unit'

rkingsbury opened this issue · 0 comments

When trying to calculate osmotic pressure, the following error occurs:

>>> import pyEQL
>>> s1=pyEQL.Solution([['Na+','0.1 mol/L'],['Cl-','0.1 mol/L']])
>>> s1.get_osmotic_pressure()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ryan/Documents/Projects/pyEQL/pyEQL/solution.py", line 615, in get_osmotic_pressure
    osmotic_pressure = - unit.R * self.get_temperature() / partial_molar_volume_water * math.log (self.get_water_activity())
TypeError: bad operand type for unary -: 'Unit'

This bug started recently and doesn't appear to occur on all systems. I've seen it with pint 0.6 and 0.7.2 on Linux, but not on Windows (Anaconda).