Re: [Tutor] Renaming computers

2006-03-23 Thread John Fouhy
On 24/03/06, Danny Yoo <[EMAIL PROTECTED]> wrote:
> Unfortunately, I really don't know Windows very well.  I'd recommend
> poking around with the win32 folks and see if it's possile to get/set the
> computer name of a Windows machine.

Microsoft has a repository of sample python scripts for automating WIndows:

http://www.microsoft.com/technet/scriptcenter/scripts/python/default.mspx

There may be something helpful there..

--
John.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Renaming computers

2006-03-23 Thread Christian Wyglendowski
Danny Yoo wrote:
> There are examples of programs that people have written to 
> automate some Windows administration tasks.  For example:
> 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/347812
> 
> is code to get the MAC address of one's ethernet card

You can also use WMI for this task.  The pywin32 package is required.
Here is an example using the interactive interpreter:

>>> from win32com.client import GetObject
>>> machine = GetObject('winmgmts://some_remote_machine/root/cimv2')
>>> query = "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE
IPEnabled = True"
>>> adapters = machine.ExecQuery(query)
>>> macs = [a.MACAddress for a in adapters]
>>> for m in macs: print m
... 
00:0E:0C:82:7A:33
00:14:22:0F:54:3C

Christian
http://www.dowski.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Renaming computers

2006-03-23 Thread Danny Yoo


On Thu, 23 Mar 2006 [EMAIL PROTECTED] wrote:

> Could you point me in the right direction, after we have ghosted the
> machines in college we have to rename them, I would like to try and
> write a program that does this through matching the MAC address with the
> computer but I'm quite new to programming and need some advice on where
> to start

Hi Joe,

This project seems doable but will take a bit of work to get right.

For introductions on fundamental programming concepts, you may find the
tutorials in:

http://wiki.python.org/moin/BeginnersGuide/NonProgrammers

very helpful in getting up to speed.  If you have questions while going
through a tutorial there, please feel free to ask the group here, and we
will be happy to help.



Once you have a foundation for programming, you should be able to better
tackle the problem.  Your proposed problem sounds very operating-system
dependent, and assuming that the machines you're talking about are Windows
boxes, you may want to talk with the python-win32 folks to see how to go
about this.  They have a mailing list here:

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


There are examples of programs that people have written to automate some
Windows administration tasks.  For example:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/347812

is code to get the MAC address of one's ethernet card, and

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/360649

is a recipe that automates remote system reboots! So I think it's just a
matter of knowing what particular win32 calls need to be done to change
the Windows name of a machine.

Unfortunately, I really don't know Windows very well.  I'd recommend
poking around with the win32 folks and see if it's possile to get/set the
computer name of a Windows machine.

But learn a little bit of programming first, at least enough so that you
can understand their advice!  *grin*


Good luck to you.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Renaming computers

2006-03-23 Thread traceyandjoe
Hello there,
Could you point me in the right direction,
after we have ghosted the machines in college
we have to rename them, 
I would like to try and write a program that does this
through matching  the MAC address
with the computer but I'm quite new to
 programming and need some advice on where to start
many thanks 
Joe

>-- Original Message --
>From: [EMAIL PROTECTED]
>Subject: Tutor Digest, Vol 25, Issue 54
>To: tutor@python.org
>Reply-To: tutor@python.org
>Date: Wed, 22 Mar 2006 08:14:53 +0100
>
>
>Send Tutor mailing list submissions to
>   tutor@python.org
>
>To subscribe or unsubscribe via the World Wide Web, visit
>   http://mail.python.org/mailman/listinfo/tutor
>or, via email, send a message with subject or body 'help' to
>   [EMAIL PROTECTED]
>
>You can reach the person managing the list at
>   [EMAIL PROTECTED]
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of Tutor digest..."
>
>
>Today's Topics:
>
>   1. how to get a line text from input file. (Keo Sophon)
>   2. how to set a value to a block of memory (Keo Sophon)
>   3. Re: Python & MP3 (Bill Burns)
>   4. Re: how to set a value to a block of memory (Kent Johnson)
>   5. Re: how to get a line text from input file. (Kent Johnson)
>   6. Re: Python & MP3 (Gabriel S Farrell)
>   7. Re: how to get a line text from input file. (Danny Yoo)
>   8. Re: how to set a value to a block of memory (Danny Yoo)
>   9. Re: how to set a value to a block of memory (Danny Yoo)
>  10. Hi (Kaushal Shriyan)
>  11. Re: Hi (Danny Yoo)
>  12. Re: Hi (Kaushal Shriyan)
>
>
>--
>
>Message: 1
>Date: Wed, 22 Mar 2006 08:27:37 +0700
>From: Keo Sophon <[EMAIL PROTECTED]>
>Subject: [Tutor] how to get a line text from input file.
>To: tutor@python.org
>Message-ID: <[EMAIL PROTECTED]>
>Content-Type: text/plain;  charset="us-ascii"
>
>Hi all,
>
>i am new to programming language and python. I wonder how to get a line
text
>
>from input file.
>
>Thanks,
>sophon
>
>
>--
>
>Message: 2
>Date: Wed, 22 Mar 2006 08:36:02 +0700
>From: Keo Sophon <[EMAIL PROTECTED]>
>Subject: [Tutor] how to set a value to a block of memory
>To: tutor@python.org
>Message-ID: <[EMAIL PROTECTED]>
>Content-Type: text/plain;  charset="us-ascii"
>
>Hi all,
>
>How can i set a value to a bytes of block of memory. In C, i think they
use
>
>memset like this.
>
>Thanks,
>Sophon
>
>
>--
>
>Message: 3
>Date: Tue, 21 Mar 2006 21:35:15 -0500
>From: Bill Burns <[EMAIL PROTECTED]>
>Subject: Re: [Tutor] Python & MP3
>To: Johanna <[EMAIL PROTECTED]>
>Cc: Tutor@python.org
>Message-ID: <[EMAIL PROTECTED]>
>Content-Type: text/plain; charset=windows-1252; format=flowed
>
>Johanna wrote:
>> Hallo
>> 
>>  
>> 
>> This is my first post, so hallo to everyone. Im just a newbee with 
>> python so I hope my msg will make some sense. J
>> 
>>  
>> 
>> Is it possible to work with MP3 in python?
>> 
>> I?m looking for a library to modify MP3s (like fade in, fade out, 
>> etc..). I know there are actually some libraries for doing this work 
>> with .wav but I didn?t find one for working with MP3. I?m not sure but
>
>> should be something like -> http://effbot.org/librarybook/wave.htm . Anyone?
>> 
>>  
>
>You may want to have a look at PyMedia:
>
>http://www.pymedia.org/
>
>HTH,
>
>Bill
>
>
>--
>
>Message: 4
>Date: Tue, 21 Mar 2006 22:17:34 -0500
>From: Kent Johnson <[EMAIL PROTECTED]>
>Subject: Re: [Tutor] how to set a value to a block of memory
>Cc: tutor@python.org
>Message-ID: <[EMAIL PROTECTED]>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>Keo Sophon wrote:
>> Hi all,
>> 
>> How can i set a value to a bytes of block of memory. In C, i think they
>use 
>> memset like this.
>
>Python does not support direct access to memory, you will need to use 
>another language or maybe a C extension to Python to do this.
>
>Kent
>
>
>
>--
>
>Message: 5
>Date: Tue, 21 Mar 2006 22:20:06 -0500
>From: Kent Johnson <[EMAIL PROTECTED]>
>Subject: Re: [Tutor] how to get a line text from input file.
>Cc: tutor@python.org
>Message-ID: <[EMAIL PROTECTED]>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>Keo Sophon wrote:
>> Hi all,
>> 
>> i am new to programming language and python. I wonder how to get a line
>text 
>> from input file.
>
>The simplest Python idiom to do something with each line of a file is this:
>   for line in open('somefile.txt'):
> # do something with line
>
>You can find out more here:
>http://docs.python.org/tut/node9.html#SECTION00920
>
>Kent
>
>
>
>--
>
>Message: 6
>Date: Wed, 22 Mar 2006 00:17:13 -0500
>From: Gabriel S Farrell <[EMAIL PROTECTED]>
>Subject: Re: [Tutor] Python & MP3
>To: tutor@python.org
>Message-ID: <[EMAIL PROTECTED]>
>Content-Type: text/plain; charset=us-ascii
>
>On Tue, Mar 21, 2006 at 09:35:15PM