How to use a modified library file?

The library: turta_lorahat

the file changed: Turta_Lora.py

the change: change ON to OFF in lines 1615 and 1630:
self.radio_set_crc(CRC_HEADER_STATES.ON) #radio set crc on

every parameter in a LoRa packet must be identical on the TX and RX end. This parameter must be set to OFF to make the Turta LoraHat communicate with existing remote stations that have CRC set to off.

I have modified the file. I have the modified file in the same directory as the LoRa RX .PY

I need to tell the RX program to use the modified Turta_Lora.py in the same folder, or replace the original with the modified file. The library won’t allow any changes, which is entirely understandable. Therefore, I can’t add the modified file to the library.

how do I get to where I need to be, from where I am?

You mean that you get a permission issue with over writing a system file?
Or something else?

For the case where you have fixed a library I would put the fixed file in the
same place as your script. Assuming the the library is a single file.
If the library is lots of file then copy all of them into you scripts folder and
remove the file you are fixing.

Raise a PR with a problem description and your fix so that the library is
fixed for future releases.

Raise a PR with a problem description and your fix so that the library is
fixed for future releases.

Turta is yet another company that made a run of products and went out of business when they sold the last one. There is nobody home to fix it. There appear to be none in actual use.

I just changed ownership of the directory to my username, and saved the modified file under a new name. I forgot about chown.

In that case i would fork the project and maintain the fixes in my fork.

1 Like

Yes, that would be the best solution. I saw that the repo is licensed under MIT so that is OK.

Unfortunately it looks like the repo is incomplete. I see no Python package metadata file needed for creating a distribution package there: pyproject.toml, older setup.cfg or even older setup.py.

It would be great to extract this information from the package on PyPI and add it to the fork.

That is annoying when the PyPI package has sources that are not from the claimed source repo. Especially files needed to build a project.

I have seen PyPI packages with patches that are not in github in the past.