nus-exams-downloader
nus-exams-downloader copied to clipboard
Convert scripts from Python 2 to Python 3
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.