Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makedirs throws WindowsError when Mendeley folder has a colon : in the name #23

Open
Zythyr opened this issue Jun 10, 2018 · 2 comments

Comments

@Zythyr
Copy link

Zythyr commented Jun 10, 2018

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 '



@Xunius
Copy link
Owner

Xunius commented Jun 10, 2018

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.

@Zythyr
Copy link
Author

Zythyr commented Jun 10, 2018

@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.

Xunius added a commit that referenced this issue Jun 24, 2018
Remove these chars in path:
  < > / : " ? * |

Retain : in the drive part

Related to issue #23: #23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants