You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting the following errors while using dokan:-
1. When I mount one file in a MountFS object and expose it using dokan, it
works fine. But when I mount 2 similar MountFS objects and expose the MountFS
using dokan I get the following error:-
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\fs\expose\dokan\__init__.py", line 940, in
mount
mp = MountProcess(fs, drive, kwds)
File "C:\Python27\lib\site-packages\fs\expose\dokan\__init__.py", line 996, in
__init__
cmd = cmd % (repr(cPickle.dumps((fs,drive,dokan_opts,nowait),-1)),)
cPickle.PicklingError: Can't pickle <type 'function'>: attribute lookup __builti
n__.function failed
Here is the code which works:-
from fs.mountfs import MountFS
from fs.expose import dokan
import urllib2
class newfile:
def __init__(self,url):
self.url=url
self.mode='rb'
self.closed=False
def open(self,mode):
self.file=urllib2.urlopen(self.url)
self.position=0
return True
def seek(self,offset):
b=urllib2.urlopen(self.url).headers.get('content-length')
c=str(offset)
headers={'Range': ('bytes='+c+'-'+b)}
ff=urllib2.Request(self.url,headers=headers)
self.file=urllib2.urlopen(ff)
self.position=offset
return offset
def read(self,length=None):
if length==None:
c=self.file.read()
return c
c=self.file.read(length)
return c
def close(self):
self.closed=True
return True
cc=MountFS()
def ff(b):
def f(x,y='rb',*z):
a1=newfile(b)
a1.open(y)
return a1
def g(*x):
b1=urllib2.urlopen(b)
c1=dict(b1.headers)
d1=int(c1.pop('content-length'))
c1['size']=d1
return c1
return f,g
b1='http://www.example.com/new.pdf'
cc.mountfile('new.pdf',*ff(b1))
dokan.mount(cc,'Q')
But if I add the following 2 lines, it doesn't work:-
b2='http://www.example.com/desktop.ini'
cc.mountfile('desktop.ini',*ff(b2))
Original issue reported on code.google.com by chandana...@gmail.com on 17 Mar 2013 at 10:45
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
chandana...@gmail.com
on 17 Mar 2013 at 10:45The text was updated successfully, but these errors were encountered: