ShayBox / Riden

A python library for Riden RD power supplies
MIT License
48 stars 13 forks source link

local run after checkout fails #5

Closed zalexua closed 2 years ago

zalexua commented 2 years ago

Imagine I want to troubleshoot the library and change some things. How I can do that without requirements to install a package and just run locally s .py files?

Attempt to locally test it fails:

$ python main.py Traceback (most recent call last): File #"/home/z/my/riden/main.py", line 5, in from .bootloader import Bootloader ImportError: attempted relative import with no known parent package

Yes, I've read articles like this one below, but how I can do that without changing current approach in source code? https://iq-inc.com/importerror-attempted-relative-import/

ShayBox commented 2 years ago

You have to use Poetry

zalexua commented 2 years ago

Thanks! Never used poetry, so had to learn it a little. Wort to add that before running the commands it assumes that you go to the checkout directory, i.e. which contains "pyproject.toml" file.

My prototype is working ;) :

# socat TCP4-LISTEN:8080,reuseaddr,fork TCP4-LISTEN:502,reuseaddr,fork
# poetry run riden -m tcp -s 127.0.0.1
ID      : 60065
SN      : 00001239
FW      : 140
TYPE    : RD6006P
INT_C   : 26
INT_F   : 78
V_SET   : 6.0
I_SET   : 3.0
....