PythonistaScripts
PythonistaScripts copied to clipboard
Hidden file or directory starting with "."
DropboxSync.py cannot handle these cases correctly. When encounter a hidden file or directory, it will raise OSError: no such file or directory.
if not os.path.exists(local_folder):
os.mkdir(local_folder)
Maybe iOS does not allow app to create a hidden file or directory inside the container? Can we simply skip these files and directories?
I ran into this in a traceback in a code repo. AFAICT, this happens when paths go too deep, e.g.
{pythonista root}/Code/foo1/foo2/foo3/ERROR
ERROR doesn't get synced and throws the traceback.
--EDIT--
Even worse, the files in foo3 don't sync, but there's no error.
Is it simply a matter of depth?
Can you post a full directory listing?
I've done some pretty deep folder layouts in testing and I'd be surprised if it was that.
Sanitizing the directory names would be a lot of work, but suffice to say that all of the file/folder names for this particular tree are plain ASCII and well within 32 characters (probably less than 15). The only dot files which I know of would be the .git dirs, and I've not seen any errors relating to them, although it's also the case that they're not syncing.
os.mkdir() isn't recursive, so if it tries to create a folder inside a folder which doesn't yet exist, it'll throw that error.
Try using os.makedirs() instead to create all directories in the specified path as needed.
@cdiscrete since you are (presumably) able to reproduce the issue, can you try the suggestion by @glitchassassin to see if that works?