rivenz / pyfilesystem

Automatically exported from code.google.com/p/pyfilesystem
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

ParentDirectoryMissingError with Webdav #189

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Using pyfilesystem 0.4 togethe with fs.contrib.davfs.DAVFS.

The following simple code leads to a ParentDirectoryMissing when closing the 
filehandle.

                import pdb; pdb.set_trace() 
                fp_out = webdav_handle.open(name, 'wb')
                fp_out.write(zip_in.open(name, 'rb').read())
                fp_out.close()

The variable 'name' points to 'xml/metadata.xml' and the directory 'xml' exists 
and is empty.

(Pdb) webdav_handle.listdir()
[u'xml', u'html', u'source', u'pdf', u'images', u'index-styles-inline.html', 
u'metadata.json', u'index_original_html.bin', u'incoming.docx']

(Pdb) webdav_handle.listdir('xml')
[]

(Pdb) print name
xml/metadata.xml

The write() operation succeeds however the close() causes 
ParentDirectoryMissingError? Why?              

> fp_out.write(zip_in.open(name, 'rb').read())
(Pdb) n
> 
/home/ajung/sandboxes/onkopedia_buildout/src/onkopedia.policy/onkopedia/policy/b
rowser/onkopedia_view.py(517)_convert_docx()
-> fp_out.write(zip_in.open(name, 'rb').read())
(Pdb) 

> 
/home/ajung/sandboxes/onkopedia_buildout/src/onkopedia.policy/onkopedia/policy/b
rowser/onkopedia_view.py(518)_convert_docx()
-> fp_out.close()
(Pdb) n
ParentDirectoryMissingError: ParentDi...ngError()
> 
/home/ajung/sandboxes/onkopedia_buildout/src/onkopedia.policy/onkopedia/policy/b
rowser/onkopedia_view.py(518)_convert_docx()
-> fp_out.close()

Original issue reported on code.google.com by zopyxfilter on 21 Oct 2014 at 1:08

GoogleCodeExporter commented 8 years ago
I think you can close this report as invalid.

The error happens with eXist-db as backend.
In my particular case the XML file was in valid and eXist-db refuses to store 
invalid XML files. The thrown exception by eXist-db is likely turned into this 
misleading exception on the Python side.

Original comment by zopyxfilter on 22 Oct 2014 at 5:51

GoogleCodeExporter commented 8 years ago
Closing as requested.

Original comment by gc...@loowis.durge.org on 28 Oct 2014 at 2:46