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

First Argument is Self Path (unrecognized arguments error) #28

Open
StephenSohng opened this issue Oct 7, 2021 · 1 comment
Open

First Argument is Self Path (unrecognized arguments error) #28

StephenSohng opened this issue Oct 7, 2021 · 1 comment

Comments

@StephenSohng
Copy link

Note: This error might be a result of my lack of understanding of how Windows shell commands work.

When executing the script from the Windows shell as such:
C:\path\of\pyqt4topyqt5file\> python pyqt4topyqt5.py fileToConvert.py

The error pyqt4topyqt5.py: error: unrecognized arguments: fileToConvert.py appears, and the conversion doesn't occur.

However, I noticed that when providing no arguments
C:\path\of\pyqt4topyqt5file\> python pyqt4topyqt5.py
the pyqt4topyqt5.py file successfully converts itself, creating the pyqt4topyqt5_PyQt5.py and the log file in the process.

I wondered if the Windows shell might be providing the pyqt4topyqt5.py filename as the first system argument, and after some quick testing that seems to be the case.

This implies to me that the Windows shell starts the system arguments with the original file name, while the program operates with the first system argument being the first given argument (which would result in the self conversion behavior seen above).

I was able to fix this by simply adding an args.pop(0) to the beginning of the init method (line 2435), after which the script seems to work as intended, though I wanted to add this as an issue rather than a change request because I'm unsure if this is how other platforms/systems operate and if there is a proper way of executing this script on Windows.

Hope this helps anyone who was having trouble.

@mikeflca
Copy link

Just want to say THANK YOU for this comment, I ran into the same issue with windows, this fixed it for me as well. :)

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