Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A tool used to manage net drive in Windows platform.

Project Description


A tool used to manage netdrive in Windows Platform.


The mainly functions are found in the python extension: netuse

python build

Or you can use your prefer way to build netuse.c, get the extension netuse. It exports the following functions:

  • autoConnect()

    Create mapped drive from shared folder, it uses the default user name. (provided by the user context for the process.)

    Raise exception if something is wrong.

  • listNetDrive()

    List all the net drives visible by current user. Return a list:

    [ (drive, remote, status, user), … ]

    Not that if the calling application is running in a different logon session than the application that made the connection, it’s unvisible for the current application. If the current user has administrator privilege, these connections could be shown, but the status is unavaliable or unconnect.

    Refer to Defining an MS-DOS Device Name

    Refer to Local and Global MS-DOS Device Names

  • mapNetDrive(remote, drive, user=None, password=None)

    Create net drive from remote folder, and return the assigned drive letter.

    It uses the default user which initialize this remote connection if user is None.

    When drive is an empty string, the system will automatically assigns network drive letters, letters are assigned beginning with Z:, then Y:, and ending with C:.

    For examples


    mapNetDrive(r’\server\data’, ‘T:’)

    mapNetDrive(r’\server\data’, ‘T:’, r’\server\jack’, ‘abc’)

    Raise exception if something is wrong.

  • removeNetDrive(drive, force=True)

    Remove mapped drive specified by drive, For example,


    Parameter force specifies whether the disconnection should occur if there are open files or jobs on the connection. If this parameter is FALSE, the function fails if there are open files or jobs.

    Raise exception if something is wrong, otherwise return None.

  • usageReport(drive)

    Return a tuple to report the usage of the net drive:

    (available, total)

    For examples,


    Raise exception if something is wrong.

  • userInfo()

    Get the logon user information, return a tuple:

    (server, domain, user)


It’s easy to use, just like a common python library.

import netuse

# Get mapped net drive

print netuse.listNetDrive()

# Map a new drive, return the drive letter

print netuse.mapNetDrive(r’\serverpath’)

# Remove a mapped drive


# Get the usage of net drive: ( free bytes, total bytes )

print netuse.usageReport(‘Z:’)

Release History

This version
History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(11.9 kB) Copy SHA256 Hash SHA256
Source None Sep 17, 2013

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers