makedirs throws WindowsError when Mendeley folder has a colon : in the name
Firstly I want to say thank you very much for creating Menotexport. This is a very useful tool!
As I was testing out Menotexport, I noticed that if my Mendely folder has a colon : in the name, then WindowsError: [Error 267] is thrown when trying to create a folder which includes a colon : in the name. Having a colon : is not valid in a file/folder name in Windows.
See error below:
Exception in thread work:
Traceback (most recent call last):
File "C:\Users\MyUserName\Anaconda2\lib\threading.py", line 801, in __bootstrap_inner
self.run()
File "C:\Users\MyUserName\Desktop\Menotexport-master\Menotexport-master\menotexport-gui.py", line 73, in run
menotexport.main(*self.args)
File "C:\Users\MyUserName\Desktop\Menotexport-master\Menotexport-master\menotexport.py", line 1324, in main
fidii,fnameii,allfolders,action,separate,iszotero,verbose)
File "C:\Users\MyUserName\Desktop\Menotexport-master\Menotexport-master\menotexport.py", line 1055, in processFolder
os.makedirs(outdir_folder)
File "C:\Users\MyUserName\Anaconda2\lib\os.py", line 157, in makedirs
mkdir(name, mode)
WindowsError: [Error 267] The directory name is invalid: u'C:/Users/MyUserName/Desktop/Menotexport-master/Menotexport-master/New folder\\FolderA/Example: SubFolder '
Hi Zythyr,
As you have observed, windows system doesn't allow : in the path, I encounter this as well, some of my files are labeled by time e.g. "2018-06-10 10:30:00", these colons trigger errors. Sometimes articles have colons in their titles, I always remove them when saving, even in Linux systems where colons are allowed. I guess the easiest way is to rename your folder, if the manual work is not too much. But you are right, I should probably add this replacement for windows systems.
@Xunius Yes I manually fixed the folder names in Mendeley and removed the colon. I was just reporting the bug in case you want to catch this error in Python and strip the colon from the folder name so that your script doesn't stop midway.