Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #30283

Module baldy compiled to pyc?

Path csiph.com!usenet.pasdenom.info!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <gandalf@shopzeus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'importing': 0.04; 'interpreter': 0.04; 'attributes': 0.07; 'correct.': 0.07; 'definitions': 0.07; 'problem?': 0.07; 'happen?': 0.09; 'imported': 0.09; 'throw': 0.09; 'file,': 0.15; 'server,': 0.15; '(starting': 0.16; 'exceptions.': 0.16; 'modules,': 0.16; 'reproduce': 0.16; 'copied': 0.17; 'thanks,': 0.18; '(or': 0.18; 'error.': 0.21; 'ones.': 0.22; 'suddenly': 0.22; 'defined': 0.22; 'needed.': 0.23; 'this:': 0.23; 'tried': 0.25; 'header:User- Agent:1': 0.26; 'compiled': 0.27; 'prevent': 0.27; 'question': 0.27; 'errors.': 0.27; 'module.': 0.27; 'class': 0.29; '(from': 0.30; 'checked': 0.30; 'file': 0.32; 'could': 0.32; 'to:addr :python-list': 0.33; 'updated': 0.34; 'server': 0.35; 'path': 0.35; 'remote': 0.35; 'subject:?': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; 'modules': 0.36; 'anything': 0.36; 'possible': 0.37; 'two': 0.37; 'files': 0.38; 'some': 0.38; 'things': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'most': 0.61; 'telling': 0.61; 'time,': 0.62; 'solve': 0.62; 'strange': 0.62; 'jobs': 0.65; 'experience.': 0.65; 'finally': 0.66; 'today': 0.67; 'today.': 0.69; 'received:204': 0.72
Date Thu, 27 Sep 2012 11:00:36 +0200
From Laszlo Nagy <gandalf@shopzeus.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0
MIME-Version 1.0
To python-list@python.org
Subject Module baldy compiled to pyc?
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1480.1348736447.27098.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348736447 news.xs4all.nl 6915 [2001:888:2000:d::a6]:34731
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:30283

Show key headers only | View raw


Today I had a strange experience. I have copied some updated py files 
(modules) to a directory on a remote server, overwritting the old ones. 
The pyc files on the server were older. Many programs are importing 
these modules, and most of them are started as background jobs (from 
cron). They started to throw all kinds of errors. I checked the py 
files, and they did have class definitions inside. However when I tried 
to use them I got AttributeError exceptions. Telling that those things 
are not in the module.

I checked their contents by importing them, and they were not defined 
indeed. Finally I have checked the module.__file__ attributes to see 
that they are imported from the right place. The __file__ contained the 
path to the compiled pyc file, but the path was correct. So finally I 
have deleted all pyc files, and suddenly every program was working 
again. (Starting the interpreter again and importing the modules again 
did not solve the problem.)

I suspect that there were two (or more) programs starting at the same 
time, writting the same pyc file at the same time. It happened with two 
modules today. Over the years, I have always copied files to this 
server, and let background programs compile the pyc files as needed.  I 
have never experienced anything like this before, and I cannot reproduce 
the error.

The question is this: do you think this could happen? Is it possible 
that something else caused the problem? What else could it be? What are 
the chances that it will happen again, and how can I prevent it?

Thanks,

    Laszlo

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Module baldy compiled to pyc? Laszlo Nagy <gandalf@shopzeus.com> - 2012-09-27 11:00 +0200
  Re: Module baldy compiled to pyc? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-27 11:13 +0000

csiph-web