[Ironpython-users] ImportError: No module named codecs

John Gietzen otac0n at gietzen.us
Tue Aug 2 14:59:32 CEST 2011

Yes, this was correct.  I had never installed the package, I was just
grabbing the Bin zip and running that.

I have now compiled the dependencies directly into my assembly using pyc.py.

On Tue, Aug 2, 2011 at 1:11 AM, Markus Schaber <m.schaber at 3s-software.com>wrote:

> Hi, John,
> Von: John Gietzen
> > I'm trying to compile Pygments to be called from a C# library, but I've
> come accross a few hurdles.
> > The first was an issue with function calls with more that 13 arguments
> throwing an error stating that the compiler is "Unable to make a reference
> to a transient module from a non-transient module."  See:
> http://ironpython.codeplex.com/workitem/31125
> > There is a previous issue saying that it was fixed in 2.7.1b1, but it
> still fails with the 150 argument call that is present in Pygments.
> 150 arguments? That seems far from sane for me, but the Pygments people
> seem to have a reason for it, I hope. :-)
> Maybe you can pack all those arguments into a tuple, effectively changing
> the call into a 1-argument call?
> Caller site:
> Change "result = function(a,b,c,d) into result = function((a,b,c,d))"
> Calee site:
> Change "def function(a,b,c,d):" to "def function(tuple):" \n "    a,b,c,d =
> tuple"
> > Now, I've run into a brick wall.  I cannot get IronPython to import the
> `codecs` module, no matter what I try.  Using reflector, I can see that a
> class the module exists in "IronPython.Modules", nut there doesn't seem to
> be a `[assembly: PythonModule]` attribute for it.
> As far as I can see, that class implements the _codecs module. The "codecs"
> module is a pure python module.
> > Even in the interactive console when I try to simply execute `import
> codecs` I get a message saying "ImportError: No module named codecs".
> I can open the codec module just fine from the interactive console, in both
> 2.7.1b2 and 2.6.0.
> > I have noticed that there is a "_codecs" module, but it does not have e.g
> the `open` method.
> The design is the same than in cPython: codecs.py is a high level module
> written in pure python, and it uses a low level native module _codecs
> internally. _codecs is a C-written Library in cPython (.dll or .so), while
> it is a C# class providing the same interface in IronPython. This allows
> IronPython to reuse the pure python part of the standard library.
> > What am I doing wrong?
> Maybe your search path (sys.path) does not include the directory where the
> python standard library was installed? Or you did not install it at all?
> For me, it was installed by the IronPython installer.
> Best regards
> Markus Schaber
> ___________________________
> We software Automation.
> 3S-Smart Software Solutions GmbH
> Markus Schaber | Developer
> Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax
> +49-831-54031-50
> Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com
> CoDeSys internet forum: http://forum.3s-software.com
> Download CoDeSys sample projects:
> http://www.3s-software.com/index.shtml?sample_projects
> Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade
> register: Kempten HRB 6186 | Tax ID No.: DE 167014915
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> http://mail.python.org/mailman/listinfo/ironpython-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20110802/eeacc511/attachment.html>

More information about the Ironpython-users mailing list