Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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; 'subject:Windows': 0.02; 'subject:not': 0.03; 'charset:iso-8859-7': 0.04; 'subject:Python': 0.06; 'attribute': 0.07; 'error:': 0.07; "subject:' ": 0.07; 'string': 0.09; '32-bit': 0.09; 'obj': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'recommends': 0.09; 'subject:module': 0.09; 'tests,': 0.09; 'windows,': 0.09; 'python': 0.11; 'windows': 0.15; '(windows': 0.16; 'backwards': 0.16; 'bit.': 0.16; 'does,': 0.16; 'filenames,': 0.16; 'lower-case': 0.16; 'means.': 0.16; 'missing?': 0.16; 'preserve': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'renamed': 0.16; 'renaming': 0.16; 'subject:PyQt': 0.16; 'subject:object': 0.16; 'subject:run': 0.16; 'uppercase': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'module': 0.19; 'trying': 0.19; 'starts': 0.20; 'seems': 0.21; 'platforms': 0.22; 'import': 0.22; 'issue.': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'directory.': 0.24; 'platform,': 0.24; 'source': 0.25; 'class.': 0.26; 'long,': 0.26; 'references': 0.26; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; 'testing': 0.29; 'possibility': 0.29; "doesn't": 0.30; 'originally': 0.30; 'lines': 0.31; 'directory,': 0.31; 'quotes': 0.31; 'file': 0.32; 'class': 0.32; 'run': 0.32; 'another': 0.32; 'linux': 0.33; 'guess': 0.33; 'not.': 0.33; 'actual': 0.34; 'subject: (': 0.35; 'problem.': 0.35; 'something': 0.35; 'case,': 0.35; 'but': 0.35; 'application': 0.37; 'two': 0.37; 'problems': 0.38; 'to:addr:python-list': 0.38; 'quote': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'called': 0.40; 'even': 0.60; 'manually': 0.60; 'strictly': 0.61; 'simply': 0.61; "you're": 0.61; 'name': 0.63; 'developed': 0.63; 'zip': 0.64; 'more': 0.64; 'within': 0.65; 'frequently': 0.68; 'reverse': 0.68; 'legal': 0.71; 'subject:skip:A 10': 0.78; 'discovered': 0.83; "'not'": 0.84; 'subject:\t': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re: Python and PyQt (Windows) - AttributeError: 'module' object has not attribute run Date: Thu, 1 Aug 2013 12:39:10 +0000 (UTC) References: <1414fafe-bc3c-4795-87db-3e8ece51f2c5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 174.32.174.29 User-Agent: XPN/1.2.6 (Street Spirit ; Linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 64 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1375360769 news.xs4all.nl 15990 [2001:888:2000:d::a6]:36849 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51728 alesssia wrote: > I developed a python3-PyQt4 application (I¢m a newbie!) on a 32-bit Linux platform, and I¢m experiencing some problems when testing it on Windows platforms (Windows 7 and 8, both 64-bit). > > I have a module called Pmc.py that contains two methods: run and main, but only the former is used in the PyQt main class. I import the module using the following statement: > > import Pmc > > and I call the function run with the following instruction: > > self.results = Pmc.run(self.p, self.m) > > obtaining this error: > > AttributeError: 'module' object has not attribute run When quoting something from your tests, please don't paraphrase or shorten. The actual error traceback starts with a line "Traceback (..." and is several lines long, and the line you did quote is missing some quotes and uses the word 'not' when i.t was originally 'no'. In this case, it doesn't matter, but frequently it will. > > After some tests, I discovered that renaming Pmc.py in pmc.py I don't know what that means. Strictly speaking I think that means you edited the content of pmc.py and renamed its use of the string to something else. But I think you're trying to say you renamed Pmc.py to pmc.py. That seems backwards to me. The reverse is more likely to fix the problem. > solves my issue. No problems are present when using Linux both 32 and > 64 bit. > I¢m using python 3.3 and PyQt 4. > > What am I missing? Linux is sensitive to case, while Windows is not. Windows does, however preserve the case when you look a the directory, either manually with DIR, or via some Python function. My guess is that somehow when the zip file was extracted, the case of this file was not preserved, and it came out pmc.py. My suggestion is to simply use all lower-case for your filenames, and change the references within your source to import pmc self.results = pmc.run Pep-8 recommends that you use an uppercase leading letter to indicate a class name. So a class of the "same" name as the file would be obj = pmc.Pmc(args) Another possibility is that you have both a pmc.py AND a Pmc.py. That's not legal in Windows, at least if they're in the same directory. And it's not advisable in Windows, if they're even in the same project. -- DaveA