Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'startup': 0.04; '2.x': 0.05; '3.2': 0.05; 'typing': 0.05; '-0700': 0.07; 'space.': 0.07; 'python': 0.08; 'subject:Problem': 0.09; 'def': 0.12; 'wrote:': 0.14; '2to3': 0.16; 'expected.': 0.16; 'failed.': 0.16; 'illusion': 0.16; 'nick': 0.16; 'so"': 0.16; 'wandering': 0.16; 'convert': 0.19; 'header:In-Reply-To:1': 0.21; "haven't": 0.22; 'file,': 0.22; 'thu,': 0.22; 'wrote': 0.22; 'parse': 0.23; 'load': 0.24; 'code': 0.24; 'changed': 0.25; 'classes': 0.26; 'testing': 0.27; 'tried': 0.27; "i'm": 0.27; 'thanks': 0.28; 'problem': 0.28; 'effect': 0.29; 'import': 0.29; 'indicated': 0.29; 'instead': 0.29; 'updated': 0.29; 'least': 0.30; 'all,': 0.30; 'received:140': 0.30; 'solved': 0.30; 'looks': 0.31; 'this.': 0.31; 'does': 0.33; 'to:addr:python-list': 0.33; 'starting': 0.33; "i've": 0.33; 'file': 0.34; 'replacement': 0.35; 'phone:': 0.36; 'skip:e 20': 0.37; 'think': 0.38; 'problem.': 0.38; 'but': 0.38; 'docs': 0.38; 'subject:: ': 0.38; 'got': 0.39; 'to:addr:python.org': 0.39; 'under': 0.40; "couldn't": 0.40; 'day': 0.67; 'subject:class': 0.84; 'replied.': 0.91; 'technique': 0.93 From: "Nick Buchholz" Subject: Re: Problem porting class to python3.2 To: python-list@python.org X-Mailer: CommuniGate Pro WebUser v5.3.13 Date: Thu, 02 Jun 2011 13:22:08 -0700 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1307052432 news.xs4all.nl 49046 [::ffff:82.94.164.166]:39004 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6890 On Thu, 02 Jun 2011 09:18:18 -0700 "Nick Buchholz" wrote: >Hi all, > I've been wandering through the DOCs for an hour and haven't found a solution to this >I'm just starting to convert from 2.5 to 3.2 and I have a problem. I have a code that looks like this. > ...code removed > First thanks to all who replied. FYI the classes in the file have been working in various environments since I wrote them in python1.3 and updated them to python 2.x in 2005. I think I solved the problem, well not solved in that I don't know why the technique I used failed. but at least the code works when used as an import. Under my 2.5 system I had a startup file that included the line ld = execfile mostly because I got tired of typing execfile('filename') to load in a file I was testing 2to3 complained it couldn't parse this line so I changed to def ld(filename): exec(compile(open(file).read(), file, 'exec')) when I tried ld('starDate.py') at the python3.2 prompt I got the indicated errors if at the prompt I instead type import starDate I get no errors and the classes and methods work as expected. I'm sure this is a name space problem but I don't know what the problem is. Its obvious that the 3.2 replacement for execfile does not have the same effect as execfile. Thanks again Nick nbuchholz@noao.edu Day phone: (520) 318-8203 "Time is an illusion, Lunchtime doubly so" - Ford Prefect Time is an illusion perpetrated by the manufacturers of space.