[Tutor] classes passing information

2010-04-21 Thread Stefan Lesicnik
Hi Guys, I'm slowly starting to understand classes coming from basic non oo scripting. I guess the problem comes in that you think you understand, and then look at code and its totally different and confusing. My question is maybe more generic with functions as opposed to classes, but i've be

Re: [Tutor] Replacing the string in a file

2010-01-22 Thread Stefan Lesicnik
> > vanam, 22.01.2010 07:44: > > > [Query]: How to write Python string to PYTHON to that file without > > intact of the full contents > > What one would normally do is: read the file (line by line if that's > ok in > your case), replace the word by the new one, write the new line to a > new > te

Re: [Tutor] socket timeout

2009-11-28 Thread Stefan Lesicnik
- "Sander Sweers" wrote: > 2009/11/27 Stefan Lesicnik : > > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > > #s.setdefaulttimeout(1) > > s.connect((proxy,port)) > > I have never used socket but a quick look at the docs [1] my guess is &

[Tutor] Python best practices

2009-11-27 Thread Stefan Lesicnik
hihi! (two in 1 day!) Is there a document, pep, wiki etc that defines best practice for python code? (maybe its more generic). I keep stumbling on things I think, it would be nice if someone mentioned this. Some things ive seen - keep you try blocks as small as possible, so you can isolate t

[Tutor] socket timeout

2009-11-26 Thread Stefan Lesicnik
Hi guys, Maybe someone can point me in the right direction, since i'm not sure why i cant get the timeout to work. Admittedly i don't know much about socket programming. Im using the below code... s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #s.setdefaulttimeout(1) s.connect((pro

[Tutor] proxy switcher - was Re: I love python / you guys :)

2009-11-16 Thread Stefan Lesicnik
On Mon, Nov 16, 2009 at 1:36 PM, bibi midi wrote: > > > On Mon, Nov 16, 2009 at 1:58 AM, Stefan Lesicnik wrote: >> >> hi, >> >> Although not a question, i just want to tell you guys how awesome you are! >> >> I am not a programmer, i can do a b

[Tutor] I love python / you guys :)

2009-11-15 Thread Stefan Lesicnik
hi, Although not a question, i just want to tell you guys how awesome you are! I am not a programmer, i can do a bit of bash. I have never officially learnt programming, but numerous times looked at some perl, c, java and never really gotten past the beginning stages of it. That all changed when

Re: [Tutor] importing variables

2009-11-12 Thread Stefan Lesicnik
On Thu, Nov 12, 2009 at 6:26 PM, bob gailer wrote: > Stefan Lesicnik wrote: >> >> Hi guys, >> >> Im trying to do something and hit a bit of a wall, potentially im >> going about this the wrong way. Essentially the problem is: >> >> features file co

Re: [Tutor] importing variables

2009-11-12 Thread Stefan Lesicnik
On Thu, Nov 12, 2009 at 4:38 PM, Alan Gauld wrote: > > "Stefan Lesicnik" wrote > >> features file contains >> rt='''text''' >> >> import features >> >> a = 'rt' >> print features.rt  #this works

[Tutor] importing variables

2009-11-12 Thread Stefan Lesicnik
Hi guys, Im trying to do something and hit a bit of a wall, potentially im going about this the wrong way. Essentially the problem is: features file contains rt='''text''' import features a = 'rt' print features.rt #this works print features.a #this fails I need to use features.a as i am ite

Re: [Tutor] PolyRange -- iterator

2009-11-04 Thread Stefan Lesicnik
On Wed, Nov 4, 2009 at 7:17 PM, Hugo Arts wrote: > On Wed, Nov 4, 2009 at 5:38 PM, spir wrote: >> Hello, >> >> as I was crawling in endless complications with unadequate ranges, I decided >> to create a "PolyRange" type able to hold arbitrary many "sub-range"; which >> means finally a big range

Re: [Tutor] for loop issue

2009-10-12 Thread Stefan Lesicnik
> Thanks for the tip on enumerate, escaped me. Much like Kent's simply > using a temporary var escaped me despite having done similar things > often... never reply on a tiring Friday. On the bright side this > blunder with indexes, iterators, and lengths has made me more aware of > other contexts f

[Tutor] for loop issue

2009-10-09 Thread Stefan Lesicnik
Hi, This feels like a strange issue, so i hope I formulate this so its understandable. I have some objects. Each object has associated values. I am looping through these objects, working with a value and printing out the value. The issue in this case is that i need to check if the one value super

[Tutor] web2py vs django

2009-09-09 Thread Stefan Lesicnik
Hi guys. I am writing this because i am little confused and wanted a more 'expert' opinion on the two frameworks. I am still quite a python newbie, and not really familiar with all the intricacies of it and the frameworks. I discovered Django as a framework first. I thought it was really great. T

[Tutor] Template long text substitution

2009-08-24 Thread Stefan Lesicnik
Hi Guys, I am trying to do the following, and im not sure how to deal with a blob of text. I have the following file i am using as a template %%NAME%% %%NUMBER%% %%REPORT%% and i have a corresponding file with values name="bob" number="123" report="report is long and spans multiple lines. It a

[Tutor] Reading text until a certain point

2009-07-24 Thread Stefan Lesicnik
Hi Guys, It seems like this keeps coming up (for me anyways), and i'm never sure how to do it. I'm very new to programming... I have a file that has text in a certain format. Lets assume ''' name: stefan id: 12345 color: blue name: joe id: 54321 color: red ''' The format is predictable. I unde

Re: [Tutor] Parse Text File

2009-06-11 Thread Stefan Lesicnik
> > Hi Denis, > > > > Thanks for your input. So i decided i should use a pyparser and try it > (im a > > relative python noob though!) > Hi Everyone! I have made some progress, although i believe it mainly due to luck and not a lot of understanding (vague understanding maybe). Hopefully this can

[Tutor] Parse Text File

2009-06-10 Thread Stefan Lesicnik
Hi Guys, I have the following text [08 Jun 2009] DSA-1813-1 evolution-data-server - several vulnerabilities {CVE-2009-0547 CVE-2009-0582 CVE-2009-0587} [etch] - evolution-data-server 1.6.3-5etch2 [lenny] - evolution-data-server 2.22.3-1.1+lenny1 [04 Jun 2009] DSA-1812-1 ap

[Tutor] OOP / Classes questions

2009-04-10 Thread Stefan Lesicnik
Hi guys, I am a relative newbie to python and OOP concepts and am trying to work through wxpython. I've seen understanding classes is essential to this and have been trying to work through them. I have a few questions re the below code (i suspect its due to a lack of my understanding of classes)

Re: [Tutor] How to send an email using Python

2009-03-10 Thread Stefan Lesicnik
Hi. I use the following to send through gmail. message = headers + text mailserver = smtplib.SMTP('smtp.gmail.com') if debug == 1: mailserver.set_debuglevel(1) mailserver.ehlo() mailserver.starttls() mailserver.ehlo() #Define username / password