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


Groups > comp.lang.python > #38696

imp.load_module error in Python 3.3

Path csiph.com!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <iurisilvio@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'deprecated': 0.07; 'filename': 0.07; 'python': 0.09; "'...'": 0.09; "'rb')": 0.09; 'fp:': 0.09; 'regression': 0.09; 'subject:error': 0.11; 'to:name:python-list': 0.15; '3.3,': 0.16; '3.3.': 0.16; 'subject:3.3': 0.16; 'load': 0.19; 'module': 0.19; 'bug?': 0.22; 'subject:skip:i 10': 0.22; 'thanks!': 0.26; 'message-id:@mail.gmail.com': 0.27; 'behaviour': 0.29; 'related': 0.30; "skip:' 10": 0.30; 'code': 0.31; 'file': 0.32; 'received:74.125.82': 0.33; 'to:addr:python-list': 0.33; '(with': 0.33; 'changed': 0.34; 'received:google.com': 0.34; 'something': 0.35; 'except': 0.36; 'but': 0.36; 'received:74.125': 0.36; "didn't": 0.36; 'anything': 0.36; 'some': 0.38; 'to:addr:python.org': 0.39; 'help': 0.40; 'change?': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:from:date:message-id:subject:to :content-type; bh=uMlTS7s/Jgs4ppvdaXnub9KrKDfobDYm1c+U0k7An2Q=; b=kVKLOuc8yOXSXixSGHZWrYz0lK2cKr8u6f2zi0SZ+24RiFh9LiHnWRypy6RFZ98a6Q 6PxS4cl1W5hxufKVWceJfpdyNU/VTk6KTHcvK3afmT+bvrHZW764K65VnFn6jAjDmqsZ 5JaQ3zzMTQufe9v1t5e44tmABAMFUwOBw/ynjTdo8zrUkbSXp3FQLN2oHgAsQYdu3cs7 PPoObKP9rgEB28mr74h9CPzZcgKIl3O0hA56VC+PKm7dX2/3AN09G5p5DH1jGDsPYjcz Hjn+mS+PHXE4R/ImLrRmIeq1MjpDxD3TUe13NhGfC+jwgE0n+oI2fa0LyPRLyqdm+1OI 1lZw==
X-Received by 10.194.21.163 with SMTP id w3mr1964926wje.56.1360596587915; Mon, 11 Feb 2013 07:29:47 -0800 (PST)
MIME-Version 1.0
From Iuri <iurisilvio@gmail.com>
Date Mon, 11 Feb 2013 13:29:27 -0200
Subject imp.load_module error in Python 3.3
To python-list <python-list@python.org>
Content-Type multipart/alternative; boundary=047d7b5d344c4e280404d57494d7
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.1661.1360596589.2939.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360596589 news.xs4all.nl 6930 [2001:888:2000:d::a6]:60644
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38696

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

I want to load a file with an invalid module name (with a dash).

    filename = '...' # something like /my/path/to/ejtp-crypto
    with open(filename, 'rb') as fp:
        my_module = imp.load_module('crypto', fp, 'ejtp-crypto', ('.py',
'rb', imp.PY_SOURCE))

It works to all Python >= 2.5, except 3.3. Some behaviour changed to break
it or is it a regression bug?

I know imp.load_module is deprecated in 3.3, but I didn't found anything
related with behaviour changes.

Also, I didn't understanded how exactly change my code to use importlib,
can you help me with this change?

Thanks!

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


Thread

imp.load_module error in Python 3.3 Iuri <iurisilvio@gmail.com> - 2013-02-11 13:29 -0200

csiph-web