Re: Starting Python... some questions

2007-03-13 Thread jezzzz .
All, thank you for your responses. I learned much and made some modifications in my small program. Currently I am attempting to put together a packet that contains a Python message (created using struct.pack) and a Scapy message (Ether()). Having a packet with combined payload from Python and S

Re: Starting Python... some questions

2007-03-13 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : > On Mon, 12 Mar 2007 21:39:11 -0700, jezonthenet wrote: > >> I started using Python a couple of days ago - here are a few >> questions: >> >> * Doesn't the __main__() method automatically execute when I run my >> python program? > > > No. > > >> * Only when I do an

Re: Starting Python... some questions

2007-03-13 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I started using Python a couple of days ago - here are a few > questions: > > * Doesn't the __main__() method automatically execute when I run my > python program? Which "__main__" method ??? Anyway, the answer is no. Every code at the top-level (which includes imp

Re: Starting Python... some questions

2007-03-12 Thread Gabriel Genellina
En Tue, 13 Mar 2007 03:13:37 -0300, je . <[EMAIL PROTECTED]> escribió: > I added the self parameter to the the chassis_id function, however I now > have a problem and question regarding encoding MAC addresses for a > struct. What string format am I supposed to use? py> data = [int(x,16)

Re: Starting Python... some questions

2007-03-12 Thread Tim Roberts
You only need three things here: [EMAIL PROTECTED] wrote: > >#!/usr/bin/python >import scapy >import struct > >class lldp_class: > def __init__(self): > self.chassis_id_tlv = None > > def chassis_id(subtype, chassis_info): Make that def chassis_id(self, subtype,

Re: Starting Python... some questions

2007-03-12 Thread jezzzz .
Jordan, Thinker, Steven, Thanks for your responses. Makes more sense now! I can run my program from the console. I added the self parameter to the the chassis_id function, however I now have a problem and question regarding encoding MAC addresses for a struct. What string format am I sup

Program __main__ function (was: Starting Python... some questions)

2007-03-12 Thread Ben Finney
[EMAIL PROTECTED], "Greenberg <"@bag.python.org, "greenbergj\""@NOSPAM.xs4all.nl, [EMAIL PROTECTED], ">"@bag.python.org writes: > [EMAIL PROTECTED] wrote: > > * Doesn't the __main__() method automatically execute when I run > > my python program? > > No, there is no special __main__ function, to

Re: Starting Python... some questions

2007-03-12 Thread Steven D'Aprano
On Mon, 12 Mar 2007 21:39:11 -0700, jezonthenet wrote: > I started using Python a couple of days ago - here are a few > questions: > > * Doesn't the __main__() method automatically execute when I run my > python program? No. > * Only when I do an import of my test.py file within python and t

Re: Starting Python... some questions

2007-03-12 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] wrote: > I started using Python a couple of days ago - here are a few > questions: > > * Doesn't the __main__() method automatically execute when I run my > python program? > * Only when I do an import of my test.py file within python

Re: Starting Python... some questions

2007-03-12 Thread Greenberg
[EMAIL PROTECTED] wrote: > I started using Python a couple of days ago - here are a few > questions: > > * Doesn't the __main__() method automatically execute when I run my > python program? > * Only when I do an import of my test.py file within python and then > run test.__main__() I can see wher

Starting Python... some questions

2007-03-12 Thread jezonthenet
I started using Python a couple of days ago - here are a few questions: * Doesn't the __main__() method automatically execute when I run my python program? * Only when I do an import of my test.py file within python and then run test.__main__() I can see where my bugs are. Is this correct? (right