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

Couldn't parse encoding #26

Closed
laixintao opened this issue Apr 11, 2018 · 5 comments
Closed

Couldn't parse encoding #26

laixintao opened this issue Apr 11, 2018 · 5 comments

Comments

@laixintao
Copy link

ERROR:Couldn't parse this file: invalid syntax (<unknown>, line 714)
    on manage.py:1 --> # -*- encoding: utf-8 -*-
ERROR:Couldn't parse this file: invalid syntax (<unknown>, line 714)
    on manage.py:1 --> # -*- encoding: utf-8 -*-
ERROR:Couldn't parse this file: invalid syntax (<unknown>, line 714)
    on manage.py:1 --> # -*- encoding: utf-8 -*-
ERROR:Couldn't parse this file: invalid syntax (<unknown>, line 714)
    on manage.py:1 --> # -*- encoding: utf-8 -*-
ERROR:Couldn't parse this file: invalid syntax (<unknown>, line 714)
    on manage.py:1 --> # -*- encoding: utf-8 -*-
@benjaminjkraft
Copy link
Contributor

Could you post the file, or at least line 714? The encoding thing is a lie, the actual issue is on line 714. (We should probably show that line number instead.

@laixintao
Copy link
Author

Hi, I reinstall the newst version, now it said:

Traceback (most recent call last):
  File "/Users/laixintao/.local/bin/slicker", line 11, in <module>
    sys.exit(main())
  File "/Users/laixintao/.local/venvs/slicker/lib/python2.7/site-packages/slicker/slicker.py", line 803, in main
    verbose=parsed_args.verbose)
  File "/Users/laixintao/.local/venvs/slicker/lib/python2.7/site-packages/slicker/slicker.py", line 681, in make_fixes
    project_root, old_fullnames, new_fullname)
  File "/Users/laixintao/.local/venvs/slicker/lib/python2.7/site-packages/slicker/inputs.py", line 204, in expand_and_normalize
    new_fullname, path_filter))
  File "/Users/laixintao/.local/venvs/slicker/lib/python2.7/site-packages/slicker/inputs.py", line 161, in _expand_and_normalize_one
    "module or package not found" % old_fullname)
ValueError: Cannot figure out what 'manage.update_zhongdeng_by_teamids' is: module or package not found

update_zhongdeng_by_teamids is a command of flask's manage.py

@benjaminjkraft
Copy link
Contributor

Interesting. What's the slicker command you're running?

@laixintao
Copy link
Author

Sorry, I realized that I already have done this by sed. So it can't find this.

I checkout the old code and run slicker it still said

ERROR:Couldn't parse this file: invalid syntax (<unknown>, line 714)
    on manage.py:1 --> # -*- encoding: utf-8 -*-

And L714 is a fstring syntax:

logger.info(f'Restoring view_company credit since {three_days_ago}')

I believe #21 should fix this.

@benjaminjkraft
Copy link
Contributor

Ah, yep! Python 3 isn't yet supported -- I'd like to add support but it's not a high priority as we're still primarily on 2.7 at Khan -- so I'll close this as a dupe of #21.

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