mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] bbremote: fix 'NoneType' object has no attribute 'encode'
@ 2024-12-12  7:19 Ahmad Fatoum
  2024-12-12  7:19 ` [PATCH 2/2] bbremote: decode bytes output of getenv and md on command line Ahmad Fatoum
  2024-12-12  8:20 ` [PATCH 1/2] bbremote: fix 'NoneType' object has no attribute 'encode' Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-12-12  7:19 UTC (permalink / raw)
  To: barebox; +Cc: Sohaib Mohamed, Ahmad Fatoum

The RatpFSServer constructor supports passing None to it, but the
command line interface panics before the function can be invoked.

As the function already supports NoneType and bytes input, just teach it
to accept str input as well.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 scripts/remote/main.py   | 4 ++--
 scripts/remote/ratpfs.py | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/remote/main.py b/scripts/remote/main.py
index 5aa176fdc426..020a78c3fcb0 100644
--- a/scripts/remote/main.py
+++ b/scripts/remote/main.py
@@ -48,7 +48,7 @@ def get_controller(args):
 
 def handle_run(args):
     ctrl = get_controller(args)
-    ctrl.export(args.export.encode())
+    ctrl.export(args.export)
     res = ctrl.command(' '.join(args.arg))
     if res:
         res = 1
@@ -160,7 +160,7 @@ def handle_listen(args):
 def handle_console(args):
     queue = Queue()
     ctrl = get_controller(args)
-    ctrl.export(args.export.encode())
+    ctrl.export(args.export)
     ctrl.start(queue)
     ctrl.send_async_console(b'\r')
     cons = ConsoleInput(queue, exit=b'\x14')  # CTRL-T
diff --git a/scripts/remote/ratpfs.py b/scripts/remote/ratpfs.py
index 3e05cf241868..3aa3eb45ac78 100644
--- a/scripts/remote/ratpfs.py
+++ b/scripts/remote/ratpfs.py
@@ -60,6 +60,8 @@ class RatpFSPacket(object):
 class RatpFSServer(object):
     def __init__(self, path=None):
         if path:
+            if isinstance(path, str):
+                path = path.encode()
             assert isinstance(path, bytes)
             self.path = os.path.abspath(os.path.expanduser(path))
         else:
-- 
2.39.5




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-12  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-12  7:19 [PATCH 1/2] bbremote: fix 'NoneType' object has no attribute 'encode' Ahmad Fatoum
2024-12-12  7:19 ` [PATCH 2/2] bbremote: decode bytes output of getenv and md on command line Ahmad Fatoum
2024-12-12  8:20 ` [PATCH 1/2] bbremote: fix 'NoneType' object has no attribute 'encode' Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox