eyeonus / Trade-Dangerous

Mozilla Public License 2.0
97 stars 31 forks source link

Minor Bug in rare case that files end up on two different drives #105

Closed Gerdofal closed 1 year ago

Gerdofal commented 1 year ago

I encountered this doing my initial import, when a file in a temp folder (on drive C) was to be moved to my data folder (on drive D). The Python os.rename function cannot "rename" a file onto a different drive. I got the error:

OSError: [WinError 17] The system cannot move the file to a different disk drive

Can be fixed by copying the file from temp to the new location, then deleting the temp file, instead of renaming. The workaround I used was to update my environment variable to put my data folder on C.

eyeonus commented 1 year ago

Obviously issues with Python need to be addressed by the Python development staff.

Gerdofal commented 1 year ago

It is not an issue with Python. The issue is that the rename command is not intended to actually move files, just rename them. Windows OS only allows renames to impact one drive. The correct code to use in this case is either dual commands (a copy, a verify, and then a delete) or one of a number of libraries that have a true move command.

eyeonus commented 1 year ago

Since TD does not rename any files in order to move them, the problem does not originate with TD.

If you would like to share the specific file that was causing the issue, I will look into seeing if I can reproduce it.

Gerdofal commented 1 year ago

I found renames at: transfers.py line 223 and 226 eddblink_plug.py line 997 cache.py line 956 update_cmd.py line 142

Unfortunately I did not take notes on which exact one had the issue. It wasn't obvious, probably burried somewhere in the trace. I'll be happy to kill my install and reinstall again with the non-working settings if you think it would help to know which one? It happened during my initial download via eddblink and my hunch is that it might be eddblink_plug.py but I'll be happy to look if that would help.

eyeonus commented 1 year ago

None of the instances of TD renaming a file move the file from the directory it is in before the rename, because, as already mentioned, TD does not use the rename command to move files.

Unfortunately I did not take notes on which exact one had the issue. It wasn't obvious, probably burried somewhere in the trace. I'll be happy to kill my install and reinstall again with the non-working settings if you think it would help to know which one? It happened during my initial download via eddblink and my hunch is that it might be eddblink_plug.py but I'll be happy to look if that would help.

Without knowing the steps that reproduce the error, I cannot identify or fix it.