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

Convert scripts from Python 2 to Python 3 #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wei2912
Copy link

@wei2912 wei2912 commented Nov 11, 2020

2to3 was runned on all three scripts, with no additional modifications made.

A couple of Python 2 libraries have been switched to their Python 3 counterparts (tkinter, _thread, httplib and urllib), which should not affect the functionality of the scripts. That said, I'm not familiar with any of these modules.

I've tested both the CLI and GUI tools on Windows 10, Python 3.9, and had no issues with them other than this Exception in the CLI tool:

PS C:\Users\weien\Workspace\nus-exams-downloader> python .\examdownloader-cli.py
Enter NUSNET ID: [hidden]
Enter password for [hidden]:
Enter module to download exams for: CS2030
Connecting to NUS Library Portals...
Downloading 1 of 7
Writing 1718SEM1-S2030.pdf
Downloading 2 of 7
Writing 1718SEM2-CS2030.pdf
Downloading 3 of 7
Writing 1718-ST-CS2030.pdf
Downloading 4 of 7
Writing 1819SEM1-CS2030.pdf
Downloading 5 of 7
Writing 1819SEM2-CS2030(Sec B).PDF
Downloading 6 of 7
Writing 1920SEM2-CS2030.pdf
Downloading 7 of 7
Writing 1930SEM1-CS2030 (Special Sem 1).pdf
7 papers downloaded successfully!
Traceback (most recent call last):
  File "C:\Users\weien\Workspace\nus-exams-downloader\examdownloader-cli.py", line 56, in <module>
    startDownload(module, username, destination, password)
  File "C:\Users\weien\Workspace\nus-exams-downloader\examdownloader-cli.py", line 25, in startDownload
    ed.getContents(module, username, password, destination, downloadCallback, updateStatus)
  File "C:\Users\weien\Workspace\nus-exams-downloader\examdownloader.py", line 123, in getContents
    downloadEndCallback(True, filename, counter)
  File "C:\Users\weien\Workspace\nus-exams-downloader\examdownloader-cli.py", line 21, in downloadCallback
    subprocess.call(['open', '-R', lastfile])
  File "C:\Python39\lib\subprocess.py", line 349, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Python39\lib\subprocess.py", line 947, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python39\lib\subprocess.py", line 1416, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

Unfortunately I don't have the time to look into this issue right now, but I believe this can be replicated on the original Python 2 scripts, so it's probably not caused by the migration.

2to3 was runned on all three scripts, with no additional modifications
made.
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

Successfully merging this pull request may close these issues.

1 participant