By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,719 Members | 1,875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,719 IT Pros & Developers. It's quick & easy.

os.listdir("\\\\delta\\public")

P: n/a
import os
print os.listdir("\\\\delta\\public")

outputs
['Bases', 'Docs', 'Drivers', 'Soft', '\xc7\xe0\xec\xe5\xed\xe0
\xd1\xe5\xf2\xe5\xe2\xee\xec\xf3 \xce\xea\xf0\xf3\xe6\xe5\xed\xe8\xfe',
'Games']
and
import os
print os.listdir("\\\\delta")

outputs
Traceback (most recent call last):
File "C:\Documents and Settings\\My Documents\Scripts\test.py", line
4, in ?
print os.listdir("\\\\delta")
WindowsError: [Errno 53] : '\\\\delta/*.*'

so how to get list of delta's shares?

Jul 18 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Egor Bolonev wrote:
print os.listdir("\\\\delta")
WindowsError: [Errno 53] : '\\\\delta/*.*'

so how to get list of delta's shares?


I'm sure someone will post the answer shortly, but you shouldn't expect
that to work.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>hostname
MINIMOO

C:\>dir \\MINIMOO
The filename, directory name, or volume label syntax is incorrect.
--
Michael Hoffman
Jul 18 '05 #2

P: n/a
Egor Bolonev wrote:
import os
print os.listdir("\\\\delta")

outputs
Traceback (most recent call last):
File "C:\Documents and Settings\\My Documents\Scripts\test.py",
line 4, in ?
print os.listdir("\\\\delta")
WindowsError: [Errno 53] : '\\\\delta/*.*'

so how to get list of delta's shares?


As Michael points out, there's no reason to think that should
have worked. You can't do a directory of a computer, only
a drive on the computer, and likewise you can't do a directory
of a computer on a network, only of the resources is shares.

Try grabbing the output of os.popen(r"net view \\delta") and
parse it to get a list of the shares:

c:\>net view \\monolith
Shared resources at \\monolith
Share name Type Used as Comment
-------------------------------------------------------------------------------
Printer Print Microsoft Office Document Image Writer
Printer2 Print hp psc 1310 series
Printer3 Print HP LaserJet 4
shared Disk I:
SharedDocs Disk
The command completed successfully.

No doubt you can also do this much more easily with the pywin32
package, or via COM (using pywin32 or ctypes), but I'll leave
that response to someone else. Or you could figure it out yourself
if you are motivated enough.

-Peter
Jul 18 '05 #3

P: n/a
On Sat, 04 Dec 2004 11:40:15 -0500, Peter Hansen <pe***@engcorp.com> wrote:
As Michael points out, there's no reason to think that should
have worked. You can't do a directory of a computer, only
a drive on the computer, and likewise you can't do a directory
of a computer on a network, only of the resources is shares.

Try grabbing the output of os.popen(r"net view \\delta") and
parse it to get a list of the shares:

c:\>net view \\monolith
Shared resources at \\monolith
Share name Type Used as Comment
-------------------------------------------------------------------------------
Printer Print Microsoft Office Document Image Writer
Printer2 Print hp psc 1310 series
Printer3 Print HP LaserJet 4
shared Disk I:
SharedDocs Disk
The command completed successfully.

No doubt you can also do this much more easily with the pywin32
package, or via COM (using pywin32 or ctypes), but I'll leave
that response to someone else. Or you could figure it out yourself
if you are motivated enough.

-Peter

[snip]

sorry my mistake :)
--
cheers,
Ishwor Gurung
Jul 18 '05 #4

P: n/a
> Try grabbing the output of os.popen(r"net view \\delta") and
parse it to get a list of the shares:

c:\>net view \\monolith
Shared resources at \\monolith
Share name Type Used as Comment
-------------------------------------------------------------------------------
Printer Print Microsoft Office Document Image Writer
Printer2 Print hp psc 1310 series
Printer3 Print HP LaserJet 4
shared Disk I:
SharedDocs Disk
The command completed successfully.

No doubt you can also do this much more easily with the pywin32
package, or via COM (using pywin32 or ctypes), but I'll leave
that response to someone else. Or you could figure it out yourself
if you are motivated enough.


how to get list of shares using pywin32?

Jul 18 '05 #5

P: n/a
Egor Bolonev wrote:
Try grabbing the output of os.popen(r"net view \\delta") and
parse it to get a list of the shares:

c:\>net view \\monolith
No doubt you can also do this much more easily with the pywin32
package, or via COM (using pywin32 or ctypes), but I'll leave
that response to someone else. Or you could figure it out yourself
if you are motivated enough.


how to get list of shares using pywin32?


Apparently you weren't motivated enough...

This is not a Python question. It's a Windows API question.
Go find the appropriate Windows API and you'll pretty much
have your answer. There are tools called Google and
comp.os.windows* and such that would be of great help (in
conjunction with a little initiative).

*Then*, and only then, if you can't get it working but have
tried, is it really appropriate to ask here in the Python
forum how to do it. Your question at the time would say something
like "I'm trying to use the WinGetNetworkSharesA() call to
retrieve a list of shares but this isn't working... see the
following traceback for details. Thanks in advance for your help."

Or you can still just ask here for someone to do the work
for you. That does often work, strangely enough.

(It's possible that the problem stems from a language issue.
If your English is such that you are finding it very difficult
to understand our responses, or to ask a more detailed question,
then my apologies for thinking you were rude. It might help
you to say that this is the problem and then you might get
more direct help.)

-Peter
Jul 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.