[Solved] Python – ” AttributeError: ‘str’ object has no attribute ‘Tc’ (Tc is one of the arguments) [closed]


It’s here:

def preos(molecule, T, P, plotcubic=True, printresults=True):
    Tr = T / molecule.Tc  # reduced temperature
...
preos("methane", 160, 10, "true", "true")

You’re clearly passing “methane” into the preos function as a string, then trying to call .Tc on that string. The error is saying exactly that. This doesn’t have anything to do with IPython. In other words, you’re trying to run "methane".Tc.

Edit: It’s hard to tell what you actually want to happen, but I think you’re not quite getting classes and methods.

solved Python – ” AttributeError: ‘str’ object has no attribute ‘Tc’ (Tc is one of the arguments) [closed]