Python Forum

Full Version: Failing to connect by 'net use'
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Greetings to those that still up at this time! Wink
I'm failing to map network shares.
I'm identifying "letters not in use" for a share to mount and use it as a variable
and using a list of IPs to connect to.
Here is sniped:
import subprocess
drl  = 'A'  # Script identifies the letter not used for mounting shares
e_ip = '10.0.0.7' # IP from IP list
mp_string = f"net use {drl}:\\\\{e_ip}\\c$ /u:someuser somepassword"
print(f" -- {mp_string}")
subprocess.call(mp_string)
Could you help me with this?
My bad! Wink
I missed little space:

before:
"net use {drl}:\\\\{e_ip}\\c$ /u:someuser somepassword"
after:
"net use"+" "+drl+":"+" \\\\"+e_ip+"\\c$ /u:someuser somepassword"	
I'm OK now.
Thank you!