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

Py2exe Dokan Mount Error #110

Open
GoogleCodeExporter opened this issue Apr 11, 2015 · 11 comments
Open

Py2exe Dokan Mount Error #110

GoogleCodeExporter opened this issue Apr 11, 2015 · 11 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. compile any Filesystem to an Executable
2. Try to Mount
3. Get the output:


-----



What version of the product are you using? On what operating system?
pyfilesystem 0.4.0  XP32 Python 2.6

Please provide any additional information below.
-----
Source Code (memfs.py):
from fs.memoryfs import MemoryFS
from fs.expose import dokan
import time
fs = MemoryFS()
mp = dokan.mount(fs ,'u' ,fsname='memfs', volname='memfs')
time.sleep(10000)
-----
Py2exe Setup Scrypt:

import py2exe, sys, os

sys.argv.append('py2exe')

setup(options = {'py2exe': {
                'bundle_files': 1,
                'unbuffered': True,
                'optimize':2
                }},
console = [{'script': "memfs.py"}],
zipfile = None,)

Original issue reported on code.google.com by mkhom...@googlemail.com on 13 Feb 2012 at 2:10

@GoogleCodeExporter
Copy link
Author

Error:

Traceback (most recent call last):
  File "memfs.py", line 5, in <module>
  File "fs\expose\dokan\__init__.pyo", line 936, in mount
  File "fs\expose\dokan\__init__.pyo", line 913, in check_ready
OSError: dokan mount process seems to be hung

Original comment by mkhom...@googlemail.com on 13 Feb 2012 at 2:15

@GoogleCodeExporter
Copy link
Author

Testet 0.4.1 from SVN, same Error!

Original comment by mkhom...@googlemail.com on 13 Feb 2012 at 3:27

@GoogleCodeExporter
Copy link
Author

Testet  pyfilesystem 0.4.0 + pyinstaller + Python 2.6, same Error!

Original comment by whooya....@gmail.com on 6 Mar 2012 at 3:39

@GoogleCodeExporter
Copy link
Author

Made a Bugreport to py2exe Project:

https://sourceforge.net/tracker/?func=detail&aid=3499396&group_id=15583&atid=115
583

Original comment by mkhom...@googlemail.com on 8 Mar 2012 at 9:22

@GoogleCodeExporter
Copy link
Author

The message comes from: fs/expose/dokan/__init__.py line:896 ::

    def check_ready(mp=None):
        if ready_callback is not False:
            check_alive(mp)
            for _ in xrange(100):
                try:
                    os.stat(drive+":\\")
                except EnvironmentError, e:
                    check_alive(mp)
                    time.sleep(0.05)
                else:
                    check_alive(mp)
                    if ready_callback:
                        return ready_callback()
                    else:
                        return None
            else:
                check_alive(mp)
                raise OSError("dokan mount process seems to be hung")

Original comment by mkhom...@googlemail.com on 11 Mar 2012 at 12:08

@GoogleCodeExporter
Copy link
Author

I got a solution!!!!
If I use the foreground=True option while mounting, there is no pickeling and 
py2exe runs like a charm. I used an own thread for mounting with the thread 
module.

The thread is like this:

    def _mount_thread_windows(self,*args):
        "Thread where the mount process runs"
        try:
            from fs.expose import dokan
        except:
            print("""Couldnt import Dokan, please reinstall it from:""")
            print("""http://dokan-dev.net/en/download""")
        self.mount = dokan.mount(self.fs_obj ,self.mountfolder ,fsname='FlexFS', volname='FlexFS',foreground=True)

Started with:

    def windows_mount(self,path=None):
        "Start the mount thread"
        self.mountfolder = 'x:'
        self._print("""Mounting: "%s" """%self.mountfolder)
        thread.start_new_thread(self._mount_thread_windows,(None,))
        self.mounted = True
        self._print("done")
        return True

Umounting works like:

    def windows_umount(self):
        self._print('Unmounting: %s'%self.mountfolder)
        from fs.expose import dokan
        done = False
        counter = 0
        while not done:
            counter += 1
            try:
                dokan.unmount(self.mountfolder)
                #~ self.__log('Umount: Umount done')
                done = True
            except:
                #~ self.__log('Umount: Umount error %s'%counter)
                time.sleep(1)

        self.mounted = False
        self._print('Done')

Without pickling other restrictions are gone, too.

fe: no logging or the use of xmlrpc library in your Filesystem.

Original comment by mkhom...@googlemail.com on 18 Feb 2013 at 6:12

@GoogleCodeExporter
Copy link
Author

[deleted comment]

2 similar comments
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

I created a lib that should solve the problem and doesnt need to pickle the 
filesystem. Plus it uses automatically fuse or dokan with the same interface. I 
hope this is usefull.

"""
fs.expose.mounter
=================

Expose an FS object fuse and dokan with a consistent usage.

This module provides the necessary interfaces to expose an FS object over
dokan or fuse, it checks automaticalli what to use.

to mount your Filesystem, do the following:

    >>> from fs.memoryfs import MemoryFS
    >>> from fs.expose import mounter
    >>> fs = MemoryFS()
    >>> mt = mounter.Mounter(fs,"Testdrive")
    >>> mt.mount()
    >>> mt.path
    '/home/"username"/Testdrive'
    >>> mt.unmount()
This should mount correct under windows, linux and mac.

"""

Original comment by mkhom...@googlemail.com on 20 Feb 2013 at 10:57

Attachments:

@GoogleCodeExporter
Copy link
Author

Looks interesting. Please post this on the discussion list...

Original comment by willmcgugan on 20 Feb 2013 at 11:01

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