interestingly, this does not happen when readablity-lxml is installed
$ ./offpunk.py gopher://floodgap.com/h/doesnotexist
To improve your web experience (less cruft in webpages),
please install python3-readability or readability-lxml
To render images inline, you need either chafa or timg.
Before Chafa 1.10, you also need python-pil
Welcome to Offpunk!
Type `help` to get the list of available command.
/home/xfnw/git/offpunk/ansicat.py:1014: MarkupResemblesLocatorWarning: The input looks more like a filename than markup. You may want to open this file and pass the filehandle into Beautiful Soup.
soup = BeautifulSoup(self.body,"html.parser")
Traceback (most recent call last):
File "/home/xfnw/git/offpunk/./offpunk.py", line 1898, in <module>
main()
File "/home/xfnw/git/offpunk/./offpunk.py", line 1889, in main
gc.onecmd(line)
File "/usr/lib/python3.11/cmd.py", line 217, in onecmd
return func(arg)
^^^^^^^^^
File "/home/xfnw/git/offpunk/./offpunk.py", line 642, in do_go
self._go_to_url(line)
File "/home/xfnw/git/offpunk/./offpunk.py", line 288, in _go_to_url
displayed, url = self.opencache.opnk(url,mode=mode,grep=grep,theme=self.theme,**params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xfnw/git/offpunk/opnk.py", line 218, in opnk
body = renderer.display(mode=mode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xfnw/git/offpunk/ansicat.py", line 169, in display
wtitle = self.get_formatted_title()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xfnw/git/offpunk/ansicat.py", line 445, in get_formatted_title
nbr = len(self.get_links())
^^^^^^^^^^^^^^^^
File "/home/xfnw/git/offpunk/ansicat.py", line 532, in get_links
self._build_body_and_links(mode)
File "/home/xfnw/git/offpunk/ansicat.py", line 510, in _build_body_and_links
results = self.render(b[0],width=width,mode=mode,startlinks=size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xfnw/git/offpunk/ansicat.py", line 1030, in render
r = self.representation(width,title=self.get_title(),center=self.center,theme=self.theme)
^^^^^^^^^^^^^^^^
File "/home/xfnw/git/offpunk/ansicat.py", line 1015, in get_title
self.title = str(soup.title.string)
^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'string'
tested with the current latest commit (f9e33914aa6f69505cd72259b168d2c2f31d0e12) on arch linux 6.6.4-arch1-1 x86_64
I’ve commited a tentative fix to avoid the crash. Could you test it?
There’s another issue here: why is the html renderer used for a gopher error?
looks like it works! thanks!
as for why it was using the html renderer: that is to be expected, gopher servers have no way to tell clients what type of file they're sending. clients have to trust whoever links to a resource to get the filetype correct, which will always be wrong in the case of an error if the type was not 0 plain text