Closed Sgiath closed 1 month ago
Digging a bit deeper it seems like the program is generating some python script in my config folder .config/rnodeconf/update/1.72/esptool.py
which is executed outside of the context of the package. Any idea how to solve it?
It seems to download its own version of esptool. We should patch the code to use the esptool package from Nixpkgs.
I think this is what's happening: https://github.com/markqvist/Reticulum/blob/a1be97bd69e54ac10bdd90f82af1b50649b35b88/RNS/Utilities/rnodeconf.py#L3689
It's literally writing a script to file and then calling it. I thought about changing the shebang to use the Nixpkgs python3 version via sed
, but I don't know how to also include the pyserial
dependency as part of it.
You could probably replace it with something like this? (taken from wiki)
#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p python3Packages.pyserial
Not sure if there are other dependencies that are needed or how to patch the code (I am so far only user of NixOS)
OK this are the imports from the file that gets decoded:
import argparse,base64,binascii,copy,hashlib,inspect,io,itertools,os,shlex,string,struct,sys,time,zlib
try:
import serial
except ImportError:
print('Pyserial is not installed for %s. Check the README for installation instructions.'%sys.executable)
raise
try:
if 'serialization' in serial.__doc__ and 'deserialization' in serial.__doc__:
raise ImportError("\nesptool.py depends on pyserial, but there is a conflict with a currently installed package named 'serial'.\n\nYou may be able to work around this by 'pip uninstall serial; pip install pyserial' but this may break other installed Python software that depends on 'serial'.\n\nThere is no good fix for this right now, apart from configuring virtualenvs. See https://github.com/espressif/esptool/issues/269#issuecomment-385298196 for discussion of the underlying issue(s).")
except TypeError:
pass
try:
import serial.tools.list_ports as list_ports
except ImportError:
print('The installed version (%s) of pyserial appears to be too old for esptool.py (Python interpreter %s). Check the README for installation instructions.'%(sys.VERSION,sys.executable))
raise
except Exception:
if sys.platform == 'darwin':
list_ports = _A
else:
raise
no other imports in the rest of the file. So it seems like only the pyserial
needs to be added.
I sent a PR here: https://github.com/NixOS/nixpkgs/pull/337285 do you wanna test it out? You can build it locally by pulling down this PR and running this in the root of nixpkgs directory:
$ nix-build -A python3Packages.rns
Look what I have found: https://github.com/markqvist/Reticulum/discussions/60#discussioncomment-2839631
Could this be the whole reason behind this?
Describe the bug
I want to use binaries from RNS package. I am able to install it and run it but once I get to the part of the program that requires
serial
(pyserial package ) it fails with this error:But I can see
pyserial
listed as dependency, so I am not sure what is going on.Steps To Reproduce
Steps to reproduce the behavior:
pkgs.python312Packages.rns
to your packagesrnodeconf --autoinstall
and select correct values for your deviceExpected behavior
pyserial
is recognized as installed dependencyNotify maintainers
@fabaff
Metadata
Add a :+1: reaction to issues you find important.