Repository navigation
Open
Milestone
Description
The navigator is unable to browse up the tree past the volume boundary on Windows.
Invoking WindowsScanner.get_volume_ids() from the following Python 2.7 code displays the current volumes on a Windows machine:
class VolumeTypes( object ):
NoType = 0
Unknown = 1
NoRootDirectory = 2
RemovableDisk = 4
LocalDisk = 8
NetworkDrive = 16
CompactDisc = 32
RamDisk = 64
AllTypes = Unknown | NoRootDirectory | RemovableDisk | LocalDisk | NetworkDrive | CompactDisc | RamDisk
@staticmethod
def get_types():
return [ VolumeTypes.NoType, VolumeTypes.Unknown, VolumeTypes.NoRootDirectory, VolumeTypes.RemovableDisk, VolumeTypes.LocalDisk, VolumeTypes.NetworkDrive, VolumeTypes.CompactDisc, VolumeTypes.RamDisk ]
@staticmethod
def get_wmi_value(type):
if type == VolumeTypes.Unknown:
result = 0
elif type == VolumeTypes.NoRootDirectory:
result = 1
elif type == VolumeTypes.RemovableDisk:
result = 2
elif type == VolumeTypes.LocalDisk:
result = 3
elif type == VolumeTypes.NetworkDrive:
result = 4
elif type == VolumeTypes.CompactDisk:
result = 5
elif type == VolumeTypes.RamDisk:
result = 6
else:
raise ValueError( "Volume type value '{}' has no WMI equivalent." % type )
return result
@staticmethod
def get_volume_type(wmi_type):
return VolumeTypes.get_types()[ wmi_type + 1 ]
class WindowsScanner( object ):
@staticmethod
def get_volumes( filter = None ):
if filter is None:
filter = VolumeTypes.AllTypes
import wmi
interface = wmi.WMI()
volumes = interface.Win32_LogicalDisk()
result = [ volume for volume in volumes if VolumeTypes.get_volume_type( volume.DriveType ) & filter != 0 ]
return result
@staticmethod
def get_occupied_volumes( filter = None ):
import os.path
result = [ volume for volume in WindowsScanner.get_volumes( filter ) if os.path.exists( volume.DriveType ) ]
return result
@staticmethod
def get_unoccupied_volumes( filter = None ):
import os.path
result = [ volume for volume in WindowsScanner.get_volumes( filter ) if not os.path.exists( volume.DriveType ) ]
return result
@staticmethod
def get_volume_ids( filter = None ):
return [ volume.DeviceID for volume in WindowsScanner.get_volumes( filter ) ]
@staticmethod
def get_occupied_volume_ids( filter = None ):
return [ volume.DeviceID for volume in WindowsScanner.get_occupied_volumes( filter ) ]
@staticmethod
def get_unoccupied_volume_ids( filter = None ):
return [ volume.DeviceID for volume in WindowsScanner.get_unoccupied_volumes( filter ) ]
I'm not sure where the code should be added, but the "Home" of the running notebook instance should probably be a location which allows for navigation across different volumes.
Metadata
Metadata
Assignees
Labels
No labels
Activity
Carreau commentedon Aug 25, 2016
Hi there,
That seem like a https://github.com/jupyter/notebook question, not an IPython one as IPython is "just" the kernel.
For security reasons the notebook cannot navigate higher than where it was started.
There are also practical reason why cross-drive is hard as wewould have to map to URLs, which means that we would have to change the URL scheme, and this not that easy. Also trying to add
..in URL often have them stripped from the actual request so we can't go above the root where the server is started.We are really lacking windows experience, as unfortunately almost none of the core dev are regular windows user. You seem to have quite a bit knowledge in this area, so any help would be welcome. In above cited repository I would look for
ContentsManagerthis is the class that maps URL to actual resources, the default one (FileContentsManager) does not understand multiple volumes; but I guess it should be possible to modify it.One other thing we want to improve is to allow for multiple content manager to be instantiated in order for user to access both local drive(s) and notebook stored on databases. I guess if we do that, then we "just" need to mount one FileNotebookManager/drive.
Does that help ? If so I think opening a similar issue there will likely a good thing to do.
Thanks !