<div dir="ltr">I want to load a file with an invalid module name (with a dash).<div><br></div><div style>    filename = '...' # something like /my/path/to/ejtp-crypto</div><div><div>    with open(filename, 'rb') as fp:</div>

<div>        my_module = imp.load_module('crypto', fp, 'ejtp-crypto', ('.py', 'rb', imp.PY_SOURCE))</div></div><div><br></div><div style>It works to all Python >= 2.5, except 3.3. Some behaviour changed to break it or is it a regression bug?</div>

<div style><br></div><div style>I know imp.load_module is deprecated in 3.3, but I didn't found anything related with behaviour changes.</div><div style><br></div><div style>Also, I didn't understanded how exactly change my code to use importlib, can you help me with this change?</div>

<div style><br></div><div style>Thanks!</div></div>