Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9225831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:40:39+00:00 2026-06-18T04:40:39+00:00

First time questioning here: I have a need to map a network drive in

  • 0

First time questioning here:

I have a need to map a network drive in windows. The location is an internal sharepoint document library.

In the cmd window:

net use g: http://na.com/DMP/DMP/programming/

is successfull –> the command completed succeffuly

os.system('"net use k: http://na.com/DMP/DMP/programming/"')

is also successful.

However i would like to use subprocess.call in the event that the drive is already mapped – i would like to try another drive

call(["net", "use", ":q", '"http://na.com/DMP/DMP/programming/"'])

This fails with “System error 67 has occured. The network name cannot be found”
I have tried many options for the last list item with no luck.

Any idea what I can stuff in there to have this complete successfully or a different method to map drives.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:40:40+00:00Added an answer on June 18, 2026 at 4:40 am

    There are at least two problems in your code:

    call(["net", "use", ":q", '"http://na.com/DMP/DMP/programming/"'])
    

    First, you’ve got ":q" where you meant "q:". This might cause the net command to interpret :q as your network location instead of your target drive, which could cause an error 67.

    Second, you’ve got an extra set of quotes around the URL: '"http://na.com/DMP/DMP/programming/"' where you should be using 'http://na.com/DMP/DMP/programming/'. When subprocess builds the string to pass to CreateProcess, it already quotes each of your parameters. So, if you quote them yourself, you end up double-quoting the parameters. There are some cases where this is actually not possible in Windows, so you end up with garbage, but I don’t think that’s the case here. You will successfully get this quoted string to net, telling it that you want to open either a relative path starting with "http: or a URL with protocol "http, or something like that. Whatever it is, it’s not a usable network location, which most likely will cause an error 67.

    As Ben pointed out, your system call has a similar problem—you put an extra pair of quotes around the entire string. If you really wanted to figure it out, there probably is some reason that this worked… but I don’t think you want to figure it out. Just take it as “I did the wrong thing, but I got lucky”, and don’t do it that way in the future.

    Finally, as the documentation says:

    On Windows, an args sequence is converted to a string that can be parsed

    This means that, if you already have a working command line for Windows, you’re better off just using it as a string, than trying to break it down into a sequence for subprocess to reassemble.

    (Keep in mind that this is only true for Windows! On other platforms, instead of building a command line string to pass to a function in the CreateProcess family, subprocess builds an array of strings to pass to a function in the exec family.)

    So, just do this:

    call("net use g: http://na.com/DMP/DMP/programming/")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first time posting here so be gentle :) On my web pages I have
First time here :) I have a textarea and an input and I would
First time asking a question here. I have two simple Javascript functions that 1.
first time poster - semi-newb to Rails. Here is my question. Suppose you have
First time asking a question here. I have a question, I have a UIImageView
first time asking. Here's the deal: I have a helper class (at least now
first time posting here, though have followed some posts every now and again. so,
First time I'm writing something here. I have a question that i hope someone
first time post here. I was hoping someone could help me make custom SPARQL
First time post. As an example, say I have a table with 12 entries;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.