![]() |
Listing HD's
Hey, i was wondering if anybody could point in the right direction. Ie give me the name of modules and links to module listing etc for a method of listing what HD's a computer, under WinXP.
Thanks, Chris |
Re: Listing HD's
Is there a way of doing this properly or would i have to do something like this
:
So is that how i will have to do it, or is there an actual method to do that for you? Chris |
Re: Listing HD's
well I don't have a solution for you, but one thing worth mentioning about the way you have it done is this: every single drive that has a letter will be shown as present. This includes mapped drives, optical drives etc.
EDIT: I found the below link that may help, but it seems as if you have to have a 3rd party module to do it, because when i tried it it gave an error about win32file http://mail.python.org/pipermail/pyt...ay/324479.html Also instead of listing out all the drives like that in one huge array, you could just do the following if you like it better: :
|
Re: Listing HD's
Indeed this is a 3rd party module which is not what im after, and yes im aware that the solution i use will show all drives, this is in actual fact how i would like it. You have to bare in mind in only shows drives in use not blank CD drives etc. And again mapped network drives are also wanted.
Chris |
Re: Listing HD's
well then in that case your solution seems to be the way to go
|
Re: Listing HD's
yes and ising string is the better option, i don't know why i didn't do that in the first place lol. O well thanks for reminding me. i May look int WMI (although it is an extra module) aparently has some functionality that could be of use to me.
Chris |
Re: Listing HD's
Quote:
|
Re: Listing HD's
|
Re: Listing HD's
Yer its another example of a third party module by the looks of it, or at least a module that is no longer supported. I'd rather use default libraries and working with the solution i have at the moment since i would like to be able to rn the script on other machines that will not have the extra modules installed.
But thanks anyway, these were the sorts of things i was getting when i googled it myself. Chris |
Re: Listing HD's
I wouldn't stop there at all. Take a look at the source code for those 3rd party modules. Its most likely that they use the Win32 API (or another C api). If so you can use ctypes to just load the right DLL and call the needed functions directly from Python. No 3rd party module is needed. I have done this myself for other areas of Win32 API and it works just fine.
|
| All times are GMT -5. The time now is 4:19 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC