From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>,
Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/2] bbremote: fix 'NoneType' object has no attribute 'encode'
Date: Thu, 12 Dec 2024 08:19:27 +0100 [thread overview]
Message-ID: <20241212071928.2466094-1-a.fatoum@pengutronix.de> (raw)
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
next reply other threads:[~2024-12-12 7:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-12 7:19 Ahmad Fatoum [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241212071928.2466094-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=sohaib.amhmd@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox