Re: [Tutor] generating independent random numbers

2010-09-29 Thread Ewald Ertl
Hi, On Wed, Sep 29, 2010 at 11:42 AM, Peter Otten <__pete...@web.de> wrote: > Carter Danforth wrote: > > > Thanks for the replies, Dave and Joel. The reason I'm not just using the > > time or datetime modules for a random date is because it's restricted to > > 1970-2038; I'm pulling dates from 16

Re: [Tutor] Finding even and odd numbers

2007-09-19 Thread Ewald Ertl
Hi Boyks, Boykie Mackay wrote: > Hi guys, > > I have come across a bit of code to find if a group of numbers is odd or > even.The code snippet is shown below: > > if not n&1: > return false > > The above should return false for all even numbers,numbers being > represented by n.I have tried

Re: [Tutor] Using my own installed python version in my directory tree.

2006-09-14 Thread Ewald Ertl
Hi Ziad Rahhal wrote: > Hi, > > I installed pythin on Linux operating system but on my own tree > directory. Now I want to get rid (not deleting) > the default python installation, which means I want my own python > version to be recognized when I use "python" command. > > PYTHONPATH has nothing

Re: [Tutor] smtp error from cgi script

2006-08-03 Thread Ewald Ertl
Hi Rob, Rob wrote: > Hi, can someone help me interpret the error output below? > > I can't tell whether this is a coding error, or a configuration error, > in which case, it would be up to my host provider. > > For privacy reasons, I have changed the actual email addresses to > [EMAIL PROTECTE

Re: [Tutor] error: (10054, 'Connection reset by peer')

2006-07-10 Thread Ewald Ertl
Hello! Grady Henry wrote: > Here is a program that I wrote using the first example at 12.2.13 > Examples at the www.python.org website, > > # Import smtplib for the actual sending function > import smtplib > > # Import the email modules we'll need > from email.MIMEText

Re: [Tutor] More network server questions

2006-06-20 Thread Ewald Ertl
server=SocketServer.TCPServer(('',self.port), FtpServer) > print "The port is: ", self.port > > > Thanks, > Tino > > > ---- > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] User input

2006-05-22 Thread Ewald Ertl
MATATA EMMANUEL wrote: > Hi there, > > Can anyone tell me how I'm having trouble executing this piece of code: > > mpg = raw_input (" Enter your mileage:") > distance = raw_input ("Enter your distance:") > galon_price = raw_input ("Enter you cost per gallon:") > make = "Honda" > model = "Accord"

Re: [Tutor] Argument check

2006-05-04 Thread Ewald Ertl
gly, to have to pass the function (method) > and > the locals() dictionary to every call of checkargs. > > I'd very much prefer a usage of checkargs similar to: > > class A(object): > def f(self,x,y): > checkargs(int, str) > def g(self,a,b,c):

Re: [Tutor] oserror [errno 20]

2006-04-03 Thread Ewald Ertl
Hi, k r fry wrote: > Hi, I am new to this list, and also to Python. > I am trying to get Python to loop through the directory DATADIR which > contains the data I want to read. I get an error: "oserror [errno 20] > : Not a directory: "Katiescint.py" > > The section of code is shown below: > >

Re: [Tutor] OSError

2006-03-15 Thread Ewald Ertl
Hi Chris, I think I've found the problem. os.listdir() gives you all entries of the directory, but your not changing to that directory. The os.path.getsize() just does not find the file in the directory "testFiles" under your current directory. See my short example below. >>> import o

Re: [Tutor] odbchelper

2006-03-03 Thread Ewald Ertl
Hi Kent! You are absolutely right. Sorry for my bad description. Kent Johnson wrote: > Ewald Ertl wrote: >> Hi! >> >> How have you started the script? As far as I could see, in the Chapter 1 of >> "Dive into Python", the odbchelper.py is just a script-Fi

Re: [Tutor] odbchelper

2006-03-03 Thread Ewald Ertl
Hi! How have you started the script? As far as I could see, in the Chapter 1 of "Dive into Python", the odbchelper.py is just a script-File and not a module to be imported, therefore the Exception with the "ImportError". I do not have a Windows box here to check if the problem is with the PythonI

Re: [Tutor] How can a function know where it was called from

2006-03-02 Thread Ewald Ertl
------- > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- Ing. Ewald Ertl HartterGruppe Phone : +43-3352-3308

Re: [Tutor] switch-case in python

2006-02-28 Thread Ewald Ertl
Hi! Have a look to the Python-Cookbook at ActiveState. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410692 This is a recipe for simulating a switch. HTH Ewald 铁石 wrote: > I know this may seem to be stupid. > but as I found that there's no > switch-case control flow in python, > a

Re: [Tutor] Unable to take input as a module

2006-02-22 Thread Ewald Ertl
t i take it is string . > > my problem is i am not able to take input as a module > help me out ! > thanks in advance. > rakesh > > > ---- > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- Ing. Ewald Ertl

Re: [Tutor] File handling: open a file at specified byte?

2006-02-19 Thread Ewald Ertl
en the same file again *AT* > 845673232 bytes - starting with the next byte after the bookmarked > point, read to end of file, and update the bookmark. > > > Thanks for any pointers- Advice appreciated. > Bri! > > ___ > Tutor maillist - Tutor@python.org >

Re: [Tutor] unknown error in simple program

2006-02-13 Thread Ewald Ertl
Hi Eli! You have a lot of calls to input() in your code. When requesting help on input you get the following output: >>> help(input) Help on built-in function input: input(...) input([prompt]) -> value Equivalent to eval(raw_input(prompt)). As you can see, the data you input is put

Re: [Tutor] self

2006-02-13 Thread Ewald Ertl
Hi Shuying! Shuying Wang wrote: > Hi, > > I'm having problems understanding some code I came across: > > class Singleton: > __single = None > def __init__( self ): > if Singleton.__single: > raise Singleton.__single > Singleton.__single = self > > What does

Re: [Tutor] smtplib with yahoo smtp server

2006-02-01 Thread Ewald Ertl
Hi! Intercodes wrote: > > My nssswitch.conf > -- > passwd: compat > group: compat > > hosts: files dns > networks: files dns > > services: files > protocols: files > rpc:files > ethers: files > netmasks: files

Re: [Tutor] smtplib with yahoo smtp server

2006-02-01 Thread Ewald Ertl
Hi! Intercodes wrote: > Ewald, > > First off, thanks for stopping by. > > >The connection via the smtplib.SMTP() could be established. > > > I dont think so. I think it fails before the login(). > > -- ex= smtplib.SMTP('smtp.mai

Re: [Tutor] smtplib with yahoo smtp server

2006-02-01 Thread Ewald Ertl
Hi! I made a copy of the source you posted. I just got a problem as expected when doing the session.login() because the access-data is invalid. The connection via the smtplib.SMTP() could be established. Perhaps there is something wrong with your namelookup. Can you try a call in the interactive

Re: [Tutor] a class knowing its self

2006-01-19 Thread Ewald Ertl
Hi! Ben Vinger wrote: > Hello > > I've been reading about how a class has access to its > own 'self', so I tried the following, but it is not > working as I would expect: > > class Skill: >def __init__(self): > self.history = [] > >def setName(self, skill): > self.nam

Re: [Tutor] Can I get some feedback on my currency converter program

2005-12-09 Thread Ewald Ertl
Hi! vikas mohan wrote: > Hi all, this is my first program in python. > > It's a currency converter mini-program, but I am not getting the desired > output. What wrong am I doing here? > > *Program code:* > > #converts currencies to Indian rupees > > def print_options(): > print "Options

Re: [Tutor] Introspection (modules and functions)

2005-11-23 Thread Ewald Ertl
Hi! I quick solution for a name module could be: >>> import os >>> for d in os.__dict__: ... a="os." + d ... if callable( eval(a) ): ... print "Callable %s" % ( eval(a)) but there should also be a recipe on activestate for that problem. I think I've red something in the Pytho

Re: [Tutor] Linux app question

2005-08-18 Thread Ewald Ertl
Hi Alberto Alberto Troiano wrote: > Hey tutorslong time don't see...*grin* > > I have a question, I've made a web page in PHP and its going to run under > Linux Red Hat 9.0 > > The page has scripts that has to be on a certain path off the system...I > have to make a CD to give the web page

Re: [Tutor] Question About chdir()

2005-08-08 Thread Ewald Ertl
Hi Don! Don Parris wrote: > The book, "Programming Python", shows an example of os.chdir() on the > Windows platform, as follows: > > os.chdir(r'c:\temp') r ... raw Strings. There will no substitution be processed. Otherwise the "\t" ( Tab ) will be inserted in the string: >>> print "a\tb" a

Re: [Tutor] try except continue

2005-07-29 Thread Ewald Ertl
Hi! I think you just want to execute the rest of the function's in someProcedure(). Perhaps this could be the solution, what you want: >>> def someProcedure(): ... for func in [ someFunc00, someFunc01, someFunc02, someFunc03 ]: ... try: ... func() ...

Re: [Tutor] Giant Calc runs, but need advice on how to make the menu repopup.

2005-07-12 Thread Ewald Ertl
nt 5/9*(f-32)," degrees Celsius" Nathan Pinno > temp_menu() Nathan Pinno > elif temp_option == 3: Nathan Pinno > print "Convert Celsius to Fahrenheit" Nathan Pinno > c = input("Degrees Celsius: ") Nathan Pinno > print (9/5*C)+32,

Re: [Tutor] maximum recursion depth exceeded !

2005-07-07 Thread Ewald Ertl
maillist - Tutor@python.org Mohammad Moghimi > http://mail.python.org/mailman/listinfo/tutor Mohammad Moghimi > --- end -- -- Ing. Ewald Ertl HartterGruppe Phone : +43-3352-33085-558 trinomic Projek

Re: [Tutor] Why is this error showing up? (Original Message: (Tutor) What's wrong with this code?) Ignore previous post.

2005-07-07 Thread Ewald Ertl
Hello! I just looked a little over the code, what it is perhaps ment to do now. As allready mentioned by Ziyad in your former post: just call "main_menu()" don't print main_menu() This calls the funciton main_men(), which prints it menu and after this the print-Command in this line

Re: [Tutor] Why is this error showing up? (Original Message: (Tutor) What's wrong with this code?) Ignore previous post.

2005-07-07 Thread Ewald Ertl
Hi! on Thu, 7 Jul 2005 01:13:48 -0600 "Nathan Pinno" <[EMAIL PROTECTED]> wrote : - Nathan Pinno > Thanks Wolfram for help with that error. Nathan Pinno > Nathan Pinno > Here's another that popped up

Re: [Tutor] Confused about error message

2005-07-04 Thread Ewald Ertl
Hi! you're missing the except-clause in the exception-handling: on Sun, 3 Jul 2005 21:37:57 -0400 gelsey torres <[EMAIL PROTECTED]> wrote : - gelsey torres > I'm new to Python and computer programming

Re: [Tutor] Lists in List question

2005-06-24 Thread Ewald Ertl
Hello Phil! the HTML-Formating look's better than the text-Version. on Thu, 23 Jun 2005 17:15:59 -0500 Phillip Hart <[EMAIL PROTECTED]> wrote : - Phillip Hart > Hello, Phillip Hart > I've been using lis

Re: [Tutor] List of regular expressions

2005-06-22 Thread Ewald Ertl
Hi Shidan! on Wed, 22 Jun 2005 00:28:44 -0400 Shidan <[EMAIL PROTECTED]> wrote : - Shidan > Hi I have a list of regular expression patterns like such: Shidan > Shidan > thelist = ['^594694.*','^689.*','

Re: [Tutor] Calling a function

2005-06-09 Thread Ewald Ertl
Hi! I don't know if I'm right here, because I've tested a simple model of what you're trying to do: on Wed, 8 Jun 2005 23:45:59 -0700 Kevin Reeder <[EMAIL PROTECTED]> wrote : - Kevin Reeder > import t

Re: [Tutor] all methods in a module

2005-05-27 Thread Ewald Ertl
Hi! I've the following solution: >>> for d in [ "random." + d for d in dir(random)]: ... if callable( eval(d) ): ... print "%30s :\n\n %s" % ( d, eval( "%s.__doc__" % ( d))) ... random.Random : Random number generator base class used by bound module function

Re: [Tutor] input()

2005-04-29 Thread Ewald Ertl
Hi! I don't have a Mac and so I don't know Macpython. on Fri, 29 Apr 2005 07:55:20 -0500 Servando Garcia <[EMAIL PROTECTED]> wrote : - Servando Garcia > Hello and thanks in advance. Servando Garcia >

Re: [Tutor] for loop

2005-04-19 Thread Ewald Ertl
Hi, I've slightly modified the for-Loop containing the "else" and not the if: >>> x = [[1,2,3],[2,4,6],[8,4,5,6],[9,8,7]] >>> for num in x: ... if 5 in num: ... break ... else: ... print "YES" ... >>> second test: >>> x = [[1,2,3],[2,4,6],[8,4,6],[9,8,7]] >>> for num in

Re: [Tutor] (no subject)

2005-04-14 Thread Ewald Ertl
Hi Jim, on Thu, 14 Apr 2005 01:09:14 -0500 "Jim and Laura Ahl" <[EMAIL PROTECTED]> wrote : - Jim and Laura Ahl > How come when I ask it to print i[2:4] from an inputted string it gives me the letters b

Re: [Tutor] function loading a file's lines to a list

2005-04-01 Thread Ewald Ertl
Hi! on Fri, 01 Apr 2005 12:01:02 +0200 Adriano Varoli Piazza <[EMAIL PROTECTED]> wrote : - Adriano Varoli Piazza > Adriano Varoli Piazza > def loadfromfile(fname): Adriano Varoli Piazza > try: Adria

[Tutor] Number of socketdescriptors > 250 and open() failed with to many open files

2005-03-31 Thread Ewald Ertl
Hi! In a class derived from thread I open a socket-Connection to a remote Server. Here I start about 500 Thread's on a solaris-System. Sofar there is no problem, when the filedescriptorlimit is set high enough with ulimit -n. My Problem is, when a function in the class tries to open a regular

Re: [Tutor] FTP retrieve

2005-03-15 Thread Ewald Ertl
n exact copy, so that each line actually ends up being on Øyvind > a separate line? Øyvind > Øyvind > Thanks in advance... Øyvind > Øyvind > Øyvind > --- end -- -- Ing. Ewald Ertl HartterGruppe Phone : +43-3352-3308

Re: [Tutor] big numbers

2005-03-15 Thread Ewald Ertl
post - sorry to be asking such a basic question. Robert Storey > Robert Storey > TIA, Robert Storey > Robert Robert Storey > ___ Robert Storey > Tutor maillist - Tutor@python.org Robert Storey > http://mail.python.org/mailman/listinfo/tutor Robert Storey > --

Re: [Tutor] getting a webpage via python

2005-03-08 Thread Ewald Ertl
Hi Paul! As mentioned earlier by Kent in this group under the subject: Subject: Re: [Tutor] Downloading from http Mark Kels wrote: > On Sat, 12 Feb 2005 09:25:10 -0500, Jacob S. <[EMAIL PROTECTED]> wrote: > >>urllib or urllib2 or maybe httplib maybe? >> >>urlopen( url[, data]) > I

Re: [Tutor] Paradox database files

2005-03-08 Thread Ewald Ertl
Hi Victor on Tue, 08 Mar 2005 10:06:50 -0600 Victor Bouffier <[EMAIL PROTECTED]> wrote : - Victor Bouffier > Hi all, Victor Bouffier > I know this is OT from Python, but does anybody know how to fix my

Re: [Tutor] Saving Entry fields in Tkinter

2005-03-01 Thread Ewald Ertl
Hi on Tue, 1 Mar 2005 15:31:10 + Adam Cripps <[EMAIL PROTECTED]> wrote : - Adam Cripps > > Adam Cripps > Thanks Ewald - this is what I have so far, with a far from perfect result: Adam Cripps >

Re: [Tutor] Saving Entry fields in Tkinter

2005-03-01 Thread Ewald Ertl
'm not sure how to parse the text according Adam Cripps > to the \n separator. Adam Cripps > Adam Cripps > Am I going down the right path here? Adam Cripps > Adam Cripps > TIA Adam Cripps > Adam --- end -- -- Ing. Ewald Ertl

Re: [Tutor] Hex to Str

2005-02-04 Thread Ewald Ertl
Hello Heiko, I do not really know what you like to get, but the hex-number's in Python are usedd in a numeric representation. As far as I have seen in the interpreter, this depends on the value: >>> a=0xabccddd >>> type(a) >>> a=0xaabb >>> type(a) If you like to see the nu

Re: [Tutor] how to separate hexadecimal

2005-02-02 Thread Ewald Ertl
Hi! Using binary operations: >>> a='0x87BE' >>> str(hex(int(a,16) & 0xFF)) '0xbe' >>> str(hex((int(a,16) & 0xFF00) / 0xFF)) '0x87' >>> HTH Ewald on Wed, 2 Feb 2005 15:10:36 +0800 jrlen balane <[EMAIL PROTECTED]> wrote : ---

Re: [Tutor] Selecting text

2005-01-19 Thread Ewald Ertl
while not refseq[i].startswith('>'): print refseq[i] i+=1 # increment until the next entry starting with '>' is found i +=1 # if search should continue if another element is present HTH

Re: [Tutor] O.T.

2004-12-30 Thread Ewald Ertl
Hi! I#m 33, married, 2 Children ( 9 months old girl & 3 year old boy ). We are living in the south of Burgenland in Austria. My mother tounge is german. I attended a secondary technical school studed electronics. After school I started working for a big company creating a power system control