fui / fui-kk

Course evaluation software for courses in informatics at the University of Oslo.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot create files with "*" in the name in Windows.

Berstad opened this issue · comments

In download_reports.py, if the downloaded report has "*" in its title, download report will try to create a file with this name in Windows, which is not possible. I suggest changing this behaviour in some manner so that the file is either created with a different character which is supported, or skipped. Error message:

Fetching Evaluation INF**** - V2017 (id=77928)
Traceback (most recent call last):
File "scripts/download_reports.py", line 205, in
main()
File "scripts/download_reports.py", line 199, in main
download_files(driver, args)
File "scripts/download_reports.py", line 177, in download_files
write_to_file(tsv_path, name_underscored, 'tsv', response.text)
File "scripts/download_reports.py", line 75, in write_to_file
with open(filename, 'w', encoding="utf-8") as f:
OSError: [Errno 22] Invalid argument: './downloads/tsv/Evaluation_INF****_-_V2017.tsv'
make.exe": *** [download] Error 1

What is actually the desired behaviour here though? Do you want the file Evaluation_INF****_-_V2017.tsv?

Yes, will have to canonify the name in some way, replace stars with some character allowed on win,mac,linux. They are excluded when using sort-downloads.py, but download-reports.py should work for downloading everything (no filter).

Relevant msdn:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx

I suggest replacing * with either + or X as these seem to be supported on all three platforms.