This is a simple fix for a crash I observed when calling 'gus' without any parameters. The following stacktrace can be reproduced by ´python3 offpunk.py <http://offpunk.py> > gus [Enter]´
---
Traceback (most recent call last):
File "offpunk/offpunk.py", line 1910, in <module>
main()
File "offpunk/offpunk.py", line 1905, in main
gc.cmdloop()
File "python3.11/cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
^^^^^^^^^^^^^^^^^
File "python3.11/cmd.py", line 217, in onecmd
return func(arg)
^^^^^^^^^
File "offpunk/offpunk.py", line 949, in do_gus
self._go_to_url(urllib.parse.urlunparse("gemini","geminispace.info <http://geminispace.info>","/search","",line,""))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: urlunparse() takes 1 positional argument but 6 were given
---
Proposed patch follows.
Thanks,
Von
Signed-off-by: vonhohenheiden <vonhohenheiden@tutanota.com>
---
offpunk.py <http://offpunk.py> | 3 +++
1 file changed, 3 insertions(+)
diff --git a/offpunk.py b/offpunk.py
index a76ac0a..6e82c72 100755
--- a/offpunk.py
+++ b/offpunk.py
@@ -945,6 +945,9 @@ Use 'ls -l' to see URLs."""
def do_gus(self, line):
"""Submit a search query to the geminispace.info <http://geminispace.info> search engine."""
+ if not line:
+ print("What?")
+ return
self._go_to_url(urllib.parse.urlunparse("gemini","geminispace.info <http://geminispace.info>","/search","",line,""))
def do_history(self, *args):
--
2.43.0
On 23/11/26 08:04, vonhohenheiden@tutanota.com wrote:
>This is a simple fix for a crash I observed when calling 'gus' without any parameters. The following stacktrace can be reproduced by ´python3 offpunk.py <http://offpunk.py> > gus [Enter]´
Hi,
Thanks for catching this. The patch looks good but cannot apply. It
might be because the stacktrace is also considered as a patch by git am
(that’s my only explanation).
Do you mind sending it again without the stacktrace or as an attachment.
A good practice in offpunk is also to add a line in the CHANGELOG (with
your name at the end). If not done, don’t worry, I will do it in a
later commit.
Thanks!
Ploum
>>--->Traceback (most recent call last):> File "offpunk/offpunk.py", line 1910, in <module>> main()> File "offpunk/offpunk.py", line 1905, in main> gc.cmdloop()> File "python3.11/cmd.py", line 138, in cmdloop> stop = self.onecmd(line)> ^^^^^^^^^^^^^^^^^> File "python3.11/cmd.py", line 217, in onecmd> return func(arg)> ^^^^^^^^^> File "offpunk/offpunk.py", line 949, in do_gus> self._go_to_url(urllib.parse.urlunparse("gemini","geminispace.info <http://geminispace.info>","/search","",line,""))> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^>TypeError: urlunparse() takes 1 positional argument but 6 were given>--->>Proposed patch follows.>Thanks,>Von>>Signed-off-by: vonhohenheiden <vonhohenheiden@tutanota.com>>--->offpunk.py <http://offpunk.py> | 3 +++>1 file changed, 3 insertions(+)>>diff --git a/offpunk.py b/offpunk.py>index a76ac0a..6e82c72 100755>--- a/offpunk.py>+++ b/offpunk.py>@@ -945,6 +945,9 @@ Use 'ls -l' to see URLs."""> > def do_gus(self, line):> """Submit a search query to the geminispace.info <http://geminispace.info> search engine.""">+ if not line:>+ print("What?")>+ return > self._go_to_url(urllib.parse.urlunparse("gemini","geminispace.info <http://geminispace.info>","/search","",line,""))> > def do_history(self, *args):>-- >2.43.0>
--
Ploum - Lionel Dricot
Blog: https://www.ploum.net
Livres: https://ploum.net/livres.html
Apologies for the additional work and thanks for accepting the patch!
Please find it attached.
Best,
Von
Nov 26, 2023, 10:20 by sourcehut23@ploum.eu:
> On 23/11/26 08:04, vonhohenheiden@tutanota.com wrote:> >This is a simple fix for a crash I observed when calling 'gus' without any parameters. The following stacktrace can be reproduced by ´python3 offpunk.py <http://offpunk.py> > gus [Enter]´>>> Hi,>> Thanks for catching this. The patch looks good but cannot apply. It > might be because the stacktrace is also considered as a patch by git am > (that’s my only explanation).>> Do you mind sending it again without the stacktrace or as an attachment.>> A good practice in offpunk is also to add a line in the CHANGELOG (with > your name at the end). If not done, don’t worry, I will do it in a > later commit.>> Thanks!>> Ploum>>>>>> >---> >Traceback (most recent call last):> > File "offpunk/offpunk.py", line 1910, in <module>> > main()> > File "offpunk/offpunk.py", line 1905, in main> > gc.cmdloop()> > File "python3.11/cmd.py", line 138, in cmdloop> > stop = self.onecmd(line)> > ^^^^^^^^^^^^^^^^^> > File "python3.11/cmd.py", line 217, in onecmd> > return func(arg)> > ^^^^^^^^^> > File "offpunk/offpunk.py", line 949, in do_gus> > self._go_to_url(urllib.parse.urlunparse("gemini","geminispace.info <http://geminispace.info>","/search","",line,""))> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^> >TypeError: urlunparse() takes 1 positional argument but 6 were given> >--->>>>>> >Proposed patch follows.> >Thanks,> >Von>>>>>> >Signed-off-by: vonhohenheiden <vonhohenheiden@tutanota.com>> >---> >offpunk.py <http://offpunk.py> | 3 +++> >1 file changed, 3 insertions(+)>>>>>> >diff --git a/offpunk.py b/offpunk.py> >index a76ac0a..6e82c72 100755> >--- a/offpunk.py> >+++ b/offpunk.py> >@@ -945,6 +945,9 @@ Use 'ls -l' to see URLs."""> > > > def do_gus(self, line):> > """Submit a search query to the geminispace.info <http://geminispace.info> search engine."""> >+ if not line:> >+ print("What?")> >+ return > > self._go_to_url(urllib.parse.urlunparse("gemini","geminispace.info <http://geminispace.info>","/search","",line,""))> > > > def do_history(self, *args):> >-- > >2.43.0>>>>>>> -- > Ploum - Lionel Dricot> Blog: https://www.ploum.net> Livres: https://ploum.net/livres.html>
On 23/11/26 07:19, vonhohenheiden@tutanota.com wrote:
>Apologies for the additional work and thanks for accepting the patch!>Please find it attached.>Best,>Von
Perfect. Just had to type |git am and the patch is applied. Thanks a
lot!