Fw: How to get volume name under Win32?

Ulf Engstrøm ulf.engstrom at b2b-link.com
Fri May 19 06:53:44 EDT 2000


 Not everything from os.popen() works on w2k, but at least you can get it
 'working at all' on that platform as opposed to win95/98. (Some of the
 functions won't work as specified, but can be used in different ways, at
 least after some fiddling around).
 >>> p = os.popen('dir')
 >>> p.read()
 ' Volume in drive D is Ulf\012 Volume Serial Number is 9C2C-3B1F\012\012
 Directo ry of D:\\downloads\\os\012\01227.04.2000  11:25       <DIR>
 .\01227.04 .2000  11:25       <DIR>          ..\01220.11.1999  11:33
<DIR>
 freebsd\01208.02.2000  10:16       <DIR>          partition\01206.04.2000
08:47
       <DIR>          qnx\01220.11.1999  11:33       <DIR>          wsh\012
          0 File(s)              0 bytes\012               6 Dir(s)
5\377668\37 7397\377056 bytes free\012'

 No pprint for sure ;)
Regards
Ulf

 Dale Strickland-Clark:
 > The rumours appear to be wrong.
 >
 > I get the same error on a Win2000 system.

 Guido:
 > > As has been said many times before, os.popen() is 99% broken on Windows
 > > 95/98.
 > > The error you posted is typical for the situation.  Rumor has it that
it
 > > works
 > > on W2000...

 Dale Strickland-Clark:

 > > > In fact ,I can't get os.popen to work at all!






More information about the Python-list mailing list