Open BenMatteson opened 5 years ago
A simple fix for this might be to put that file into the home directory of the user: HISTORY_FILE = os.path.join(os.path.expanduser("~"), "command_history.txt")
it also breaks help
I think that I noticed that as well, but didn't get a chance to figure it out.
I'm a little confused about how that breaks help? There doesn't seem to be any obvious connection to help (it doesn't use that constant)...
I suspect that the correlation may be that both help
and the history
commands are throwing a FileNotFoundError exception, which we're catching within print_help()
?
help uses a relative path, and cdl changes the actual working directory, so the relative path breaks.
Ah... It seems like that's also the case if the program/script is called from outside of the project folder (e.g., ./path/to/FTP_main.py
). We might be able to get around that by using something like this:
HELP_FILE_LOCATION = os.path.join(os.path.dirname(os.path.realpath(__file__)), "help_files/")
because command history is saved in the local working directory and cdl changes the local working directory, new
command_history.txt
files are created in each new directory after cdl.