imp.load_module error in Python 3.3

I

Iuri

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top