Giter Club home page Giter Club logo

Comments (8)

tonybaloney avatar tonybaloney commented on July 17, 2024

Yikes!

What version of Python is this and what version of Wily do you have installed?

Please can you run wily index and share some of the output

from wily.

cometchaser avatar cometchaser commented on July 17, 2024

Here see the conda environment file:
wilyenv.txt

and the index gives:
`$wily index
--------Configuration---------
Path: D:\Projects\foobar
Archiver: git
Operators: {'halstead', 'maintainability', 'cyclomatic', 'raw'}

-----------History------------
╒════════════╤═══════════════════════════════════╤════════════╕
│ Revision │ Author │ Date │
╞════════════╪═══════════════════════════════════╪════════════╡
│ 6a0dcb9 │ CometChaser │ 2019-03-22 │
├────────────┼───────────────────────────────────┼────────────┤
`
... and so on ...

I also add some more output from the wily diff:
`$ wily.exe diff foobar.py > test.txt

Using default metrics ['cyclomatic.complexity', 'maintainability.mi', 'raw.loc', 'halstead.h1']
Traceback (most recent call last):
File "c:\programdata\anaconda3\envs\foobar\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\programdata\anaconda3\envs\foobar\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\envs\foobar\Scripts\wily.exe_main
.py", line 9, in
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\click\core.py", line 764, in call
return self.main(*args, **kwargs)
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\click\core.py", line 1137, in invoke
return process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\click\decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\wily_main
.py", line 245, in diff
config=config, files=files, metrics=metrics, changes_only=not all, detail=detail
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\wily\commands\diff.py", line 130, in diff
headers=headers, tabular_data=results, tablefmt=DEFAULT_GRID_STYLE
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\colorama\ansitowin32.py", line 41, in write
self.__convertor.write(text)
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\colorama\ansitowin32.py", line 162, in write
self.write_and_convert(text)
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\colorama\ansitowin32.py", line 187, in write_and_convert
self.write_plain_text(text, cursor, start)
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\colorama\ansitowin32.py", line 195, in write_plain_text
self.wrapped.write(text[start:end])
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\colorama\ansitowin32.py", line 41, in write
self.__convertor.write(text)
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\colorama\ansitowin32.py", line 162, in write
self.write_and_convert(text)
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\colorama\ansitowin32.py", line 190, in write_and_convert
self.write_plain_text(text, cursor, len(text))
File "c:\programdata\anaconda3\envs\foobar\lib\site-packages\colorama\ansitowin32.py", line 195, in write_plain_text
self.wrapped.write(text[start:end])
File "c:\programdata\anaconda3\envs\foobar\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-145: character maps to
`

from wily.

GabdaZM avatar GabdaZM commented on July 17, 2024

I have a similar problem, but with almost every command (build command works):
wily-err-log.txt

from wily.

tonybaloney avatar tonybaloney commented on July 17, 2024

@GabdaZM are you also using anaconda? I think this is related to the default encoding profiles in the environment.

from wily.

GabdaZM avatar GabdaZM commented on July 17, 2024

No, I am using PyCharm on wndows, and using UTF-8 encoding, LF line ending.

from wily.

cbetylkata avatar cbetylkata commented on July 17, 2024

I am having the same issue when I tried using the pre-commit hook. Also using PyCharm on Windowns 10 with UTF-8 encoding and LF as line separator.
wily, version 1.19.0

Has there been any resolution or possible workaround for this issue?

P.S. Manually typed in diff command works OK, but pre-commit hook doesn`t.

from wily.

devdanzin avatar devdanzin commented on July 17, 2024

Seems to be the generic case for the issue I found in #182: the Windows terminal (or default file encoding) may not be able to handle all characters that we want to print/write. We should be able to encode and decode the output with an error handler. However, we'd first need to choose which error handler (or whether to make it configurable) to use.

from wily.

devdanzin avatar devdanzin commented on July 17, 2024

There's a different issue going on here: the DEFAULT_GRID_STYLE is "fancy_grid", which uses characters outside of what charmap can understand.

It's possible to check sys.stdout.encoding and, if it's not UTF-8, use "grid" to tabulate. It gives comparable output with ASCII-only characters. I'll send a PR so we can discuss whether it's worth it and how to do it.

The other issue, what happens when some data (like author names or commit messages) we want to print contain unprintable characters, should be solvable by using errors="replace" in a encode/decode operation.

from wily.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.