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

Issue with dokan #149

Open
GoogleCodeExporter opened this issue Apr 11, 2015 · 1 comment
Open

Issue with dokan #149

GoogleCodeExporter opened this issue Apr 11, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

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

@GoogleCodeExporter
Copy link
Author

For pickeling Problems you could test this Mounter Lib:
https://groups.google.com/forum/?fromgroups=#!topic/pyfilesystem-discussion/boH9
GjXMwmc

Original comment by mkhom...@googlemail.com on 25 Mar 2013 at 4:51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant