geit icon indicating copy to clipboard operation
geit copied to clipboard

Error while writing output html

Open malko opened this issue 5 years ago • 5 comments

on ubuntu 20.20 with a fresh geit install get this error while attempting generation:

Collecting and analyzing contribution data...
Collecting and generating commits and contribution matrices...
Writing HTML output...
Traceback (most recent call last):
  File "/usr/lib/python3.8/sre_parse.py", line 1039, in parse_template
    this = chr(ESCAPES[this][1])
KeyError: '\\u'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "geit.py", line 135, in <module>
    handle_cli()
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "geit.py", line 89, in handle_cli
    filename = write_html_output(json_physical_data, identifier)
  File "geit.py", line 117, in write_html_output
    updated_file = re.sub(r'<script tag="data-entry-tag">.*<\/script>',
  File "/usr/lib/python3.8/re.py", line 208, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/usr/lib/python3.8/re.py", line 325, in _subx
    template = _compile_repl(template, pattern)
  File "/usr/lib/python3.8/re.py", line 316, in _compile_repl
    return sre_parse.parse_template(repl, pattern)
  File "/usr/lib/python3.8/sre_parse.py", line 1042, in parse_template
    raise s.error('bad escape %s' % this, len(this))
re.error: bad escape \u at position 444928

pip version: pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

malko avatar Aug 18 '20 12:08 malko

Hey @malko

I haven't been able to reproduce the error on a similar version of Ubuntu with a clean installation of Geit. It seems the error is caused by something going wrong with the regex, I have only seen this error before when trying to run it on Windows natively (currently not supported). When you ran Geit, did you use a publicly accessible repository? If so, could you share the link to it?

kelhaji avatar Aug 19 '20 14:08 kelhaji

No sorry it's on a private local repository. Can it be related to some content being in french with utf8 characters ? Anyway thanks for the reply

malko avatar Aug 19 '20 14:08 malko

Hmm. Perhaps so, I tried to run it in a repository containing French sentences but it didn't yield an error. Do you get the same or similar error when running Geit on a different repository? Could you run echo $LANG and locale charmap separately in your terminal and paste the output here? It might be related to your terminal character encoding.

kelhaji avatar Aug 19 '20 14:08 kelhaji

here's the result of commands:

ツ【malko@hslap:~】➤ echo $LANG
fr_FR.UTF-8
ツ【malko@hslap:~】➤ locale charmap
UTF-8

Will try on another repo later and let you know if the problem occur or not.

malko avatar Aug 19 '20 14:08 malko

I've just ran it on another repository without error. Difference the repo was in english. Same machine / env and settings. So seems to be somewhat related to the content of the repo i'm trying to run geit against.

malko avatar Aug 20 '20 14:08 malko