Re: listing computer hard drives with python

2008-05-05 Thread python newbie
Sorry, I forgot to copy the list.

Looks like you are doing this on Windows.  Windows has a built in command call 
fsutil that would work in this situation.  The syntax would be:

C:\Documents and Settings\username>fsutil fsinfo drives

Drives: C:\ D:\ E:\

To find out the type of drive you can use:

C:\Documents and Settings\username>fsutil fsinfo drivetype c:

c: - Fixed Drive

On a side note you can call an external command via:

import os
os.system('fsutil fsinfo drives')
os.system('fsutil fsinfo drivetype c:')

I hope this helps.

PS: I am not sure about the privileges  that are required to run fsutil.

Disclaimer: I am new to python and programming.  This may not be they python 
way of doing things.

Pete



Ohad Frand <[EMAIL PROTECTED]> wrote:Hi
  I am looking for a way to get a list of all active logical hard drives of the 
computer (["c:","d:"..])
   
  Thanks,
  Ohad
  
  --
http://mail.python.org/mailman/listinfo/python-list

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.--
http://mail.python.org/mailman/listinfo/python-list

Logical Operator and code block not executing (newbie question)

2008-04-16 Thread python newbie
Hello,
I am running into a small problem of not having a code block not executing 
after after a logical operator is true.   What am I missing or doing wrong.  
Any thoughts or opinions would be greatly appreciated.  

The  block that isn't being executed follows:

 elif (guess == the_number) and (tries < total_attempts):

print "You guessed it! The number was", the_number
print "And it only took you", tries, "tries!\n"
print "The  correct answer is: ", the_number

Below is the complete script:
#! /usr/bin/python
# Aurthor: Me
# Purpose: Demonstrates
# Date: April 15, 2008

import random

print "\tWelcome to 'Guess My Number'!"
print "\nI'm thinking of a number between 1 and 100."
print "Try to guess it in as few attempts as possible.\n"

# set the initial values
the_number = random.randrange(100) + 1
guess = int(raw_input("Take a guess: "))
tries = 1
total_attempts = 3

# guessing loop
while (guess != the_number): 
if (guess > the_number) and (tries < total_attempts):
print "Lower..."
print "You have...", total_attempts - tries, "left."
print "The  correct answer is: ", the_number
elif (guess < the_number) and (tries < total_attempts):
print "Higher..."
print "You have...", total_attempts - tries, "left."
print "The  correct answer is: ", the_number
elif (guess == the_number) and (tries < total_attempts):
print "You guessed it! The number was", the_number
print "And it only took you", tries, "tries!\n"
print "The  correct answer is: ", the_number
elif (tries >= total_attempts):
print "You're out of guess"
print "You have...", total_attempts - tries, "left."
print "You need more practice."
print "The  correct answer is: ", the_number
break
else: 
print "You shouldn't see this message..."
print "You have...", total_attempts - tries, "left."
print "The  correct answer is: ", the_number
break
guess = int(raw_input("Take a guess: "))
tries += 1


raw_input("\n\nPress the enter key to exit.")

PS: I am new to coding & scripting.

Pete


   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.-- 
http://mail.python.org/mailman/listinfo/python-list

Mailing list question

2008-04-16 Thread python newbie
Hello,
Just curious; can I post a basic programming question to this mailing list?

Thanks  in advance.

Pete

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.-- 
http://mail.python.org/mailman/listinfo/python-list

Does FTPLIB have a 'local change directory' ?

2005-08-06 Thread python newbie
Hi, first I wanted to say that:

 I have finally been able to ftp a file in my python app -  however, it 
works like this:

 When you use storbinary and hand it a full path 
"c:\myfiles\morefiles\picture.gif"..
 it will find the file on your hard drive, and
then upload the file,  but on the ftp server, it literally names the file:

"c:\myfiles\morefiles\picture.gif"


I'd like to be able to first

  ftplib.lcd( "c:\myfiles\morefiles"  )

 and then just

storbinary( picture.gif .. ).

But the python doc doesn't show any LCD.

Or am I going to have to be satisfied with having to just use a rename on 
the server,
after uploading the file?

Thanks
Steve





 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Harvestman install not working

2005-04-06 Thread python newbie
First of all, please disregard the extra posts, Anand, I need to really 
really get a new newsreader.  It kept on giving me an error, making me think 
that each sendbutton click wasnt' working.

 My mistake, I use the Harvestman.Py in the main folder, of course.

It works fine.
 Thanks again.

"Anand" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi
>
>Latest version of py2exe does not support the option
> --force-imports anymore I think. You can edit the .bat file to remove
> that option. It should work.
>
> -Anand
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Harvestman install not working

2005-04-06 Thread python newbie
Thanks Anand, (both for writing Harvest,  and for the reply.)
By the way, I did try that, so that the command is:

c:\python23\python.exe install.py py2exe -O2 --packages=encodings

And this time the dist folder was created, but there were only these files
in there:

library.zip
python23.dll
unicodedata.pyd
w9xpopen.exe
zlib.pyd
_sre.pyd

I'll keep trying though.


"Anand" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
>Latest version of py2exe does not support the option
> --force-imports anymore I think. You can edit the .bat file to remove
> that option. It should work.
>
> -Anand
>



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Harvestman install not working

2005-04-06 Thread python newbie
Thanks Anand, (both for writing Harvest,  and for the reply.)
By the way, I did try that, so that the command is:

c:\python23\python.exe install.py py2exe -O2 --packages=encodings

And this time the dist folder was created, but there were only these files
in there:

library.zip
python23.dll
unicodedata.pyd
w9xpopen.exe
zlib.pyd
_sre.pyd

I'll keep trying though.





"Anand" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi
>
>Latest version of py2exe does not support the option
> --force-imports anymore I think. You can edit the .bat file to remove
> that option. It should work.
>
> -Anand
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Harvestman install not working

2005-04-06 Thread python newbie
Thanks Anand, (both for writing Harvest,  and for the reply.)
By the way, I did try that, so that the command is:

c:\python23\python.exe install.py py2exe -O2 --packages=encodings

And this time the dist folder was created, but there were only these files
in there:

library.zip
python23.dll
unicodedata.pyd
w9xpopen.exe
zlib.pyd
_sre.pyd

I'll keep trying though.


"Anand" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
>Latest version of py2exe does not support the option
> --force-imports anymore I think. You can edit the .bat file to remove
> that option. It should work.
>
> -Anand
>



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Harvestman install not working

2005-04-06 Thread python newbie
Thanks Anand, (both for Harvestman and for the reply.)
By the way, I did try that, so that the command is:

c:\python23\python.exe install.py py2exe -O2 --packages=encodings

And this time the dist folder was created, but there were only these files 
in there:

library.zip
python23.dll
unicodedata.pyd
w9xpopen.exe
zlib.pyd
_sre.pyd

I'll keep trying though.


"Anand" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi
>
>Latest version of py2exe does not support the option
> --force-imports anymore I think. You can edit the .bat file to remove
> that option. It should work.
>
> -Anand
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Harvestman install not working

2005-04-06 Thread python newbie
Hi, I previously had Harvestman installed and working okay, but somehow the
latest version won't install.

I have Python23 installed.

When I attempt to execute the py2exesetup.bat file (on Windows XP), I get:

--

E:\zips\internet\utilities\HarvestMan-1.4\HarvestMan-1.4.tar\HarvestMan-1.4\Harv
estMan>rem Batch file for creating py2exe executable for Harvestman
usage: install.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: install.py --help [cmd1 cmd2 ...]
   or: install.py --help-commands
   or: install.py cmd --help

error: option --force-imports not recognized
Press any key to continue . . .


--

Any suggestions?
 Thanks



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OS env for Windows

2005-02-13 Thread python newbie
Cool thanks a lot. Always wanted to use win32api module too.
"Tony Meyer" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>> Is there any other way
>> of distinguishing between XP and 2000 I wonder?
>
> WinXP SP2:
>
 import win32api
 major, minor, spack, platform, ver_str = win32api.GetVersionEx()
 print major, minor, spack, platform, ver_str
> 5 1 2600 2 Service Pack 2
>
> WinNT SP4:
>
 import win32api
 major, minor, spack, platform, ver_str = win32api.GetVersionEx()
 print major, minor, spack, platform, ver_str
> 5 0 2195 2 Service Pack 4
>
> =Tony.Meyer
> 


-- 
http://mail.python.org/mailman/listinfo/python-list