473,386 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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
5 2771
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
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
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
> 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
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 thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.