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

async is a reserved keyword in Python (since Python 3.7) #2695

Open
Stricken1670 opened this issue Jan 31, 2025 · 0 comments
Open

async is a reserved keyword in Python (since Python 3.7) #2695

Stricken1670 opened this issue Jan 31, 2025 · 0 comments
Labels

Comments

@Stricken1670
Copy link

+python_fakeinstall:3> python -m installer '--destdir=/usr/pkgmk/work/visidata/pkg' dist/visidata-0.41-py3-none-any.whl
*** Error compiling '/usr/pkgmk/work/visidata/pkg/usr/local/lib/python3.13/site-packages/visidata/vd.py'...
  File "/usr/local/lib/python3.13/site-packages/visidata/vd.py", line 1195
    def async(func):
        ^^^^^
SyntaxError: invalid syntax

Claude's idea with that:

This error is occurring because async is a reserved keyword in Python (since Python 3.7), and it cannot be used as a function name or decorator name. The VisiData code appears to be using async as a decorator name, which is causing the syntax error during installation.
This is likely an older version of VisiData (version 0.41) that was written before async became a keyword. The modern way to handle this would be to rename the decorator to something like async_def, asynchronous, or run_async.
You have a few options:

  • Install an older version of Python (pre-3.7) if you absolutely need this specific version of VisiData
  • Install a newer version of VisiData that has fixed this syntax issue
  • If you need to modify the code locally, you could patch the file to rename the async decorator

Would you like me to help you with any of these approaches?

I went with the renaming solution, and as a proof of concept ran:

    sed -i 's|@async|@async2|' $(grep -rl '@async' .)
    sed -i 's|def async|def async2|' $(grep -rl 'def async' .)

After which the error was gone, and vd works as expected. I suppose someone can improve on my brutal handiwork, being a mere mortal sysadmin.

hboetes pushed a commit to hboetes/sports that referenced this issue Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant