[python-win32] win32net.NetUseAdd buglet (or doc buglet)

Scott Prive scottprive at earthlink.net
Wed Apr 23 11:54:17 EDT 2003


----- Original Message -----
From: "Mark Hammond" <mhammond at skippinet.com.au>
To: "'Scott Prive'" <scottprive at earthlink.net>
Cc: <python-win32 at python.org>
Sent: Tuesday, April 22, 2003 8:28 PM
Subject: RE: [python-win32] win32net.NetUseAdd buglet (or doc buglet)


> > Re: NetUseAdd(), what docs were you looking at? I could see on the
> > ActiveState documentation online, that gave a brief
> > description of the API
> > NetUseAdd()...
>
> Their online docs say "Help file built: 06/04/01", but their docs are as
bad
> as what I have here - it says almost nothing!!  I can't see how these docs
> gave you *any* info about the structure names, without manually looking
for
> the PyUSE_INFO structures.  I have updated the docs to at least point to
the
> relevent USE_INFO structure documentation, and it is here that you find
the
> magic attribute names needed (or in the MSDN docs on these same
structures).
>
> ActiveState are a little behind in their releases, but the last major
update
> to win32net was ages ago.

It's been asserted on the activepython list that it "should" now be safe to
install your win32all 15x over AS Python's version, even if you use Komodo
(I do). I'll try this first, but switch distributions entirely if I must in
order to run the latest.


>
> > then referred to the MSDN website for more
> > info, which did
> > show a username/password.
>
> What URL?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/net
mgmt/netuseadd.asp
>
> > You can see in my output, it
> > actually *does* work
> > (or seems to even if I interact with the mount manually).
>
> Note that these functions will generally ignore elements they don't
> understand.  So check that your code actually needs this item at all.

You nailed it. I did some initial testing before my post, but became misled
and didn't isolate it enough.

What probably happened is my initial code (both 'password' and 'passwd')
sent non-unicode strings. Whatever this translated into (probably nonsense),
the function returned 'bad username or password' but only when I used the
['password'] key.

I don't know unicode well, but except for my ['remote'] key, everything else
should look the same in unicode, no?
If not, can you detect non-unicode strings and throw a specific exception
for it? Of course, I know you're overloaded with work so the question is
theoretical. :-)

Jens sent me a corrected snippet that used unicode. I triple checked and
tightened my share permissions (removing 'Everyone') and this is indeed
working the way it is expected to.

>
> > I just noticed the win32wnet wrappers have MUCH better
> > documentation... is
> > win32net depreciated or otherwise less desired than win32wnet
> > (should I read
> > into it that way)?
>
> The win32wnet functions are designed for "simple" tasks, and are available
> on Windows 9x.  win32net is more for administration tasks, and is only
> available for NT.  win32net can do a real lot, but getting your head
around
> these level "structure-dictionaries" can be hard.

Understood; I'll use each when appropriate.

I also start front-to-back reading of your book today -- I hope it has been
sucessful for you.  :-D


>
> Mark.
>




More information about the Python-win32 mailing list