Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   imp.load_module error in Python 3.3 (http://www.velocityreviews.com/forums/t957517-imp-load_module-error-in-python-3-3-a.html)

Iuri 02-11-2013 03:29 PM

imp.load_module error in Python 3.3
 
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!



All times are GMT. The time now is 09:06 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.