I'm connecting to a UNC path using win_unc
:
import win_unc as unc
def list_all_printers_on_server(servername):
creds = unc.UncCredentials(r"<USER>", "<PASS>")
authz_unc = unc.UncDirectory(servername, creds=creds)
conn = unc.UncDirectoryConnection(authz_unc)
conn.connect()
if conn.is_connected():
print "connected"
print conn.get_connection_status()
print conn.get_path()
else:
print "not connected "
print conn.connect()
I'm able to get it connected and print the path and such, but what I want to do is print everything in the UNC path. If I use os.listdir()
I get the following error:
connected
ok
\\<UNC>
Traceback (most recent call last):
File "fdap.py", line 504, in <module>
list_all_printers_on_server(r"\\<UNC>")
File "fdap.py", line 471, in list_all_printers_on_server
os.listdir(servername)
WindowsError: [Error 67] The network name cannot be found: '<UNC>/*.*'
Now I don't understand why it is telling me that the path cannot be found when it tells me that the connection status is ok
, how can I connect to this path and list everything inside of it?
How to kill a query running by pd.read_sql and connected by sqlalchemy (or mysql.connector)
Radio and checkbox cannot be checked when inside BootStrap Modal
With the following, I would like to control the EOL:
I have very basic python knowledgeThis is my code so far: when i run this code the error UnboundLocalError: local variable 'response' referenced before assignment on line 7 displays
This question already has an answer here:
Given a bunch of names, how can we find out which are Chinese names and which are English names? For the Chinese names, I build a list of the Chinese last names to find out the Chinese namesFor example, Bruce Lee, Lee is a Chinese last name, so we regard...