olivierkes / manuskript

A open-source tool for writers
http://www.theologeek.ch/manuskript
GNU General Public License v3.0
1.77k stars 235 forks source link

Main program does not load (FileNotFound error) - filename path too long > 260 chars #313

Open OlsonAC1 opened 6 years ago

OlsonAC1 commented 6 years ago

Program suddenly stopped being able to load. Here is the CMD output:

Debug: Web rendering engine used: QWebView Running manuskript version 0.6.0. Note: No translator found or loaded for locale en_US. Loading: C:/Users/olsonac1.2CE12909PS/Google Drive/Hobbies/Stories/Story Manuskript/Keenan Story.msk Detected file format version: 1. Zip: False. Traceback (most recent call last): File "manuskript\ui\welcome.py", line 68, in showEvent File "manuskript\mainWindow.py", line 517, in loadProject File "manuskript\mainWindow.py", line 742, in loadDatas File "manuskript\loadSave.py", line 66, in loadProject File "manuskript\load_save\version_1.py", line 656, in loadProject FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/olsonac1.2CE12 909PS/Google Drive/Hobbies/Stories/Story Manuskript\Keenan Story\outline\1-JM Turned-_Keenan-s_age_revealed\0-Finish_Marty-s_investigation\0-JMadjusting to_vampirism_and_living_at_Lucas-_place-_and_Marty_investigation_becoming_releva nt-.md'

The "file not found" is in fact there. For context, this project was the last one opened in the program and I did not edit the files outside the program.

Here is the info for that MSK's settings.txt in case it's relevant:

{ "autoSave": true, "autoSaveDelay": 1, "autoSaveNoChanges": true, "autoSaveNoChangesDelay": 5, "corkBackground": { "color": "#926239", "image": "" }, "corkSizeFactor": 71, "corkStyle": "new", "defaultTextType": "md", "dict": "en_US", "dontShowDeleteWarning": false, "folderView": "cork", "frequencyAnalyzer": { "phraseMax": 5, "phraseMin": 2, "wordExclude": "a, and, or", "wordMin": 1 }, "fullScreenTheme": "newtheme", "lastTab": 6, "openIndexes": [ 0, [ "25" ], null ], "outlineViewColumns": [ 0, 8, 9, 7, 11 ], "revisions": { "keep": true, "rules": { "2592000": 8640.0, "3600": 60.0, "600": 6.0, "86400": 360.0, "null": 60480.0 }, "smartremove": true }, "saveOnQuit": true, "saveToZip": false, "spellcheck": true, "textEditor": { "background": "#fff", "backgroundTransparent": false, "cursorNotBlinking": false, "cursorWidth": 1, "font": "MS Shell Dlg 2,10,-1,5,50,0,0,0,0,0", "fontColor": "#000", "indent": true, "lineSpacing": 100, "marginsLR": 0, "marginsTB": 0, "maxWidth": 0, "misspelled": "#F00", "spacingAbove": 5, "spacingBelow": 5, "tabWidth": 20, "textAlignment": 0 }, "viewMode": "fiction", "viewSettings": { "Cork": { "Background": "Nothing", "Border": "Nothing", "Corner": "Label", "Icon": "Nothing", "Text": "Nothing" }, "Outline": { "Background": "Nothing", "Icon": "POV", "Text": "Nothing" }, "Tree": { "Background": "Nothing", "Icon": "Nothing", "InfoFolder": "Count", "InfoText": "WC", "Text": "Compile", "iconSize": 24 } } }

gedakc commented 6 years ago

Thank you @OlsonAC1 for reporting this issue and providing the console output.

I believe the issue is that the filename path is too long (the one in the console log is 265 characters long). This issue is mentioned in Python Issue18199 - Windows: support path longer than 260 bytes using "\?\" prefix.

You might try removing the max path limitation in Windows. However this might not resolve the issue because the PyInstaller package for Windows is built using Python 3.4.4 and the link mentions using Python 3.6+. The reason we use Python 3.4.4 in the Windows PyInstaller package is to maintain compatibility with Windows XP. Of course you could also consider installing Python 3.6+ to Run Manuskript from Source Code on Windows.

Another work-around would be to shorten the path length. This might be accomplished by either renaming/shortening some of the directory names in the path above the project .msk file and directory. Alternatively you might copy all the project files/directories higher up in the directory hierarchy.

Please let us know what you choose to do and if it works.

OlsonAC1 commented 6 years ago

I renamed the file to a shorter name and that worked, though I don't know why. I forgot to mention that I tried reinstalling the files to start fresh but that didn't help.

gedakc commented 6 years ago

I renamed the file to a shorter name and that worked, though I don't know why

The issue arises due to a maximum path limitation of 260 characters in Windows.

Thanks for reporting that a shorter name worked. There do appear to be some code work-arounds, but I'm not sure if we can implement these and still retain compatibility with Windows XP.

gedakc commented 6 years ago

I found another interesting link regarding maximum path lengths in Windows:

Why does the 260 character path length limit exist in Windows?

Some of the answers indicate that Windows does not apply extended path work-arounds to all Windows API functions. Hence it might be best to keep folder (chapter) and file (text) name paths short to avoid the 260 character maximum length.

EDIT: This issue is specific to the Windows operating system.