question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

upgrade checker fails for non python files

See original GitHub issue

What happened:

Running upgrade checker 1.2.0 on one of my repos produced the following errors:

ChainBetweenDAGAndOperatorNotAllowedRule:

Traceback (most recent call last):
 File "/home/airflow/.local/bin/airflow", line 37, in <module>
  args.func(args)
 File "/usr/local/lib/python3.6/site-packages/airflow/upgrade/checker.py", line 118, in run
  all_problems = check_upgrade(formatter, rules)
 File "/usr/local/lib/python3.6/site-packages/airflow/upgrade/checker.py", line 38, in check_upgrade
  rule_status = RuleStatus.from_rule(rule)
 File "/usr/local/lib/python3.6/site-packages/airflow/upgrade/problem.py", line 44, in from_rule
  result = rule.check()
 File "/usr/local/lib/python3.6/site-packages/airflow/upgrade/rules/chain_between_dag_and_operator_not_allowed_rule.py", line 72, in check
  problems.extend(self._check_file(file_path))
 File "/usr/local/lib/python3.6/site-packages/airflow/upgrade/rules/chain_between_dag_and_operator_not_allowed_rule.py", line 40, in _check_file
  lines = file_pointer.readlines()
 File "/usr/local/lib/python3.6/codecs.py", line 321, in decode
  (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa3 in position 14: invalid start byte

ImportChangesRule:

Traceback (most recent call last):
  File "/home/airflow/.local/bin/airflow", line 37, in <module>
    args.func(args)
  File "/usr/local/lib/python3.6/site-packages/airflow/upgrade/checker.py", line 118, in run
    all_problems = check_upgrade(formatter, rules)
  File "/usr/local/lib/python3.6/site-packages/airflow/upgrade/checker.py", line 38, in check_upgrade
    rule_status = RuleStatus.from_rule(rule)
  File "/usr/local/lib/python3.6/site-packages/airflow/upgrade/problem.py", line 44, in from_rule
    result = rule.check()
  File "/usr/local/lib/python3.6/site-packages/airflow/upgrade/rules/import_changes.py", line 145, in check
    new_problems, new_providers = self._check_file(file)
  File "/usr/local/lib/python3.6/site-packages/airflow/upgrade/rules/import_changes.py", line 114, in _check_file
    content = file.read()
  File "/usr/local/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa3 in position 14: invalid start byte

I traced it to a .docx file that caused these exceptions but it took work to figure it out as the traceback doesn’t specify what file caused it.

This is a similar to https://github.com/apache/airflow/issues/13349 which fixed it for AirflowMacroPluginRemovedRule

Anything else we need to know: Since occupied with migration it will take a while before I can raise PR to address this. In case someone can handle sooner you can take this.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
digitalsimbojacommented, Feb 16, 2021

Thanks I am working on it

1reaction
kaxilcommented, Feb 24, 2021

Fixed by https://github.com/apache/airflow/pull/14344 and will be released in upgrade check 1.3.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Including non-Python files with setup.py - Stack Overflow
If you specify non-python files outside of your package directories in MANIFEST.in, they will be included in your distribution, but they will not...
Read more >
Porting Python 2 Code to Python 3 — Python 3.11.1 ...
The best way to do this is with feature detection of whether the version of Python you're running under supports what you need....
Read more >
ModuleNotFoundError: no module named Python Error [Fixed]
When you try to import a module in a Python file, Python tries to resolve this module in several ways. · As the...
Read more >
Knowledge Bits — Common Python Packaging Mistakes
An overview of common mistakes made in creating & building a Python package and how to avoid them.
Read more >
check-manifest - PyPI
Are you a Python developer? Have you uploaded packages to the Python Package Index? Have you accidentally uploaded broken packages with some files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found