inventree / inventree-python

Python library for communication with inventree via API
https://docs.inventree.org/en/latest/api/python/python/
MIT License
26 stars 34 forks source link

Error: method __getattr__ of object class does not exist #126

Closed Slan85 closed 2 years ago

Slan85 commented 2 years ago

Hello, File inventree/base.py makes a call to super().__getattr__(), which does not exist (on line 248 on current commit 3319518). I guess this line should be replaced with return super().__getattribute__(name)

miggland commented 2 years ago

That error often appears if you're trying to access an attribute which doesn't exist. Can you show some code which gives you the error?

SchrodingersGat commented 2 years ago

@Slan85 thanks for reporting. Bug fix on the way!

Slan85 commented 2 years ago

Thanks for fixing this, that was fast.

That error often appears if you're trying to access an attribute which doesn't exist. Can you show some code which gives you the error?

I was trying to import a Partkeepr database into inventry, using https://github.com/rgilham/PK2InvenTree On startup, PK2Inventree is trying to delete all parts from InvenTree database, and print a message for each parts, When the database is empty (fresh install), it tries to print a part without name, which triggered the error.

There's probably some things to change in PK2InvenTree too, but it's not maintained anymore, and it was still a bug to call a non existing methods. Other minor changes are required on PK2InvenTree to make it work again, I did manage to import my partkeepr database and I will share the updated script. However, I never did a fork and/or pull request. I'm sure it's not difficult but I need to take some time to figure out how it works.