Picani
Picani

Reputation: 179

Creating two objects of the same classes from different imports made them look as different classes

I have a the following file in Python:

If I do import SB from an IPython shell or Jupyter and I load some data with SB.interval_from_file, I get a list of Interval objects. But, if I then manually create an Interval object with SB.Interval, I cannot compare that object with any other from the list. I get instead

TypeError: '<' not supported between instances of 'Interval' and 'Interval'

Any idea what's going on?

edit: If I print the type of the objects, the ones in the list (so from SB.interval_from_file have the type SB.interval.Interval whereas the object created in the IPython shell with SB.Interval is of type interval.Interval. Is that behavior expected?

Upvotes: 2

Views: 65

Answers (1)

jjmontes
jjmontes

Reputation: 26904

Maybe your pythonpath is including both SB and its parent directory.

Make sure you include just the appropriate directory.

Upvotes: 1

Related Questions