Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of "ly indent" via stdin/out #49

Closed
patrickgardella opened this issue Nov 13, 2015 · 1 comment
Closed

Use of "ly indent" via stdin/out #49

patrickgardella opened this issue Nov 13, 2015 · 1 comment

Comments

@patrickgardella
Copy link

I am trying to use "ly indent" from vim as an external command. Essentially using the built-in stdin/stdout functionality of ly like this:
cat music.ly | ly indent

However, I get a Python error when I try

Traceback (most recent call last):
  File "/usr/local/bin/ly", line 4, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/ly/cli/main.py", line 262, in main
    opts, commands, files = parse_command_line()
  File "/Library/Python/2.7/site-packages/ly/cli/main.py", line 185, in parse_command_line
    for arg in args:
  File "/Library/Python/2.7/site-packages/ly/cli/main.py", line 172, in <genexpr>
    args = (a.decode(sys.stdin.encoding) for a in sys.argv[1:])
TypeError: decode() argument 1 must be string, not None

The normal command line functionality works:
ly indent music.ly -o music.ly

I'm using the latest python-ly that pip installs, 0.9.2.

Am I missing something on the command line, or is this a bug?

Patrick

@patrickgardella patrickgardella changed the title Command line use of "ly indent" Use of "ly indent" via stdin/out Nov 13, 2015
@wbsoft
Copy link
Collaborator

wbsoft commented Nov 14, 2015

Thanks for reporting! This is indeed a bug. The code erroneously assumes that sys.stdin.encoding always returns a valid encoding name (on my system it is 'UTF-8').

When piping input from a file, the encoding attribute is None and this code fails in parsing command line arguments.

@wbsoft wbsoft closed this as completed in 88b8d97 Nov 14, 2015
bryantgeorge added a commit to bryantgeorge/python-ly that referenced this issue Jan 6, 2020
Resolve "Support italic lyrics"

Closes frescobaldi#49

See merge request bgeorge/python-ly!57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants