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


Groups > comp.lang.python > #38696 > unrolled thread

imp.load_module error in Python 3.3

Started byIuri <iurisilvio@gmail.com>
First post2013-02-11 13:29 -0200
Last post2013-02-11 13:29 -0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

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

#38696 — imp.load_module error in Python 3.3

FromIuri <iurisilvio@gmail.com>
Date2013-02-11 13:29 -0200
Subjectimp.load_module error in Python 3.3
Message-ID<mailman.1661.1360596589.2939.python-list@python.org>

[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!

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web