Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Exception on --raw: 'TypeError: sequence item 1: expected string or Unicode, Tag found' #120

Open
vitaly-zdanevich opened this issue Sep 22, 2019 · 1 comment

Comments

@vitaly-zdanevich
Copy link

 g show mynotename --raw
Traceback (most recent call last):      
  File "/usr/local/bin/g", line 1441, in main
    Notes().show(**ARGS)
  File "/usr/local/bin/g", line 1074, in show
    out.showNoteRaw(note)
  File "/home/vitaly/soft/geeknote/out.py", line 36, in wrapped
    result = fn(*args, **kwargs)
  File "/home/vitaly/soft/geeknote/out.py", line 223, in showNoteRaw
    printLine(Editor.ENMLtoText(note.content, 'pre'))
  File "/home/vitaly/soft/geeknote/editor.py", line 95, in ENMLtoText
    content = u''.join((content, c))
TypeError: sequence item 1: expected string or Unicode, Tag found

It depends on content of the note (because fails not for every note but only for one). To reproduce - create note with this content:

$ 7z b

7-Zip [32] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,32 bits,2 CPUs Intel(R) Core(TM)2 CPU         T5500  @ 1.66GHz (6F6),ASM)

Intel(R) Core(TM)2 CPU         T5500  @ 1.66GHz (6F6)
CPU Freq:  1644  1653  1645  1655  1654  1653  1653  1653  1653

RAM size:    2445 MB,  # CPU hardware threads:   2
RAM usage:    441 MB,  # Benchmark threads:      2

                       Compressing  |                  Decompressing
Dict     Speed Usage    R/U Rating  |      Speed Usage    R/U Rating
         KiB/s     %   MIPS   MIPS  |      KiB/s     %   MIPS   MIPS

22:       2457   166   1439   2390  |      37438   199   1610   3196
23:       2404   169   1450   2450  |      37028   200   1606   3205
24:       2373   173   1476   2552  |      35949   198   1593   3156
25:       2337   177   1505   2669  |      35347   200   1577   3146
----------------------------------  | ------------------------------
Avr:             171   1468   2515  |              199   1596   3176
Tot:             185   1532   2846

Side question - is it possible to preserve monospace font for some notes? For example for this example above when I save output from some cli. In official Evernote client it is possible to mark area as code - nothing similar in Geeknote?

P.S.: Just thank you that you continue to maintain this project, I use Geeknote every day, this is one of my basic utilities.

@jeffkowalski
Copy link
Owner

Thank you for the great bug report, @vitaly-zdanevich. I can follow the steps to reproduce the error.
Right now, it looks like there is a <br clear="none"/> that confuses the converter, similar to what is described here:
https://stackoverflow.com/questions/14264102/python-beautifulsoup-typeerror-sequence-item-0-expected-string-tag-found

I will look into a proper fix.

(In the meantime, I think that the monospace font is created by the <code></code> encapsulation, which should be available by creating a note in markdown format and backquoting the content, like this:

geeknote create --title "codetest" --notebook "Test" --tag "test" --rawmd --content "`This is a code test`"

If that's not working for you, please open a separate issue so that each issue contains only one topic).

Thanks for your continued interested in geeknote. I maintain it for the same reason - it's part of my daily/basic utilities.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants