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
ParserSyntaxError when a module have a "from django.utils import timezone" import #421
Comments
Hi @luzfcb! Thanks for the report. That's a stange one, I cannot reproduce with the CLI installed in my development environment for the project, however, I'm able to do so if I install django-codemod with pipx, like you do. I've removed a few options you've used and I tracked down the bug to
I'll take a look, but in the meantime you can avoid passing |
I came here to report this bug too. Using the latest version:
If it's helpful, I have a public project you can reproduce it on: https://github.com/trailhawks/trailhawks.com |
Yes I think I've nailed down the problem to this section, it's just wrong (it replaces the import for the parent module, even if the thing being codemodded isn't used in the file): django-codemod/django_codemod/visitors/base.py Lines 167 to 175 in 7942036
I'll probably disable this feature and push a new release (hopefully tomorrow) until I can make a fix, this is probably breaking a lot of other things. |
I think the issue can be avoided by using django-codemod<1.4 since it was most likely introduced in #347 |
As per #421, this is not working currently, so I'm putting this feature behind an experimental feature flag until it's fixed properly.
As per #421, this is not working currently, so I'm putting this feature behind an experimental feature flag until it's fixed properly.
The problem should no longer happen in 1.5.6, I've disabled the problematic feature for now. I'll try to fix it properly later, not really have time at the moment... |
Describe the bug
I'm migrating a medium-sized codebase, and I found this strange behavior: if the code has a "
from django.utils import timezone
" import, a ParserSyntaxError is raisedTo Reproduce
Additional context
The text was updated successfully, but these errors were encountered: