[Ironpython-users] Differences with pyc-compiled assemblies?

Jeff Hardy jdhardy at gmail.com
Mon Nov 12 00:06:33 CET 2012


On Sun, Nov 11, 2012 at 12:45 PM, Nicholas Devenish <misnomer at gmail.com> wrote:
> I'm seeing weird differences between importing plain packages and adding references to the compiled versions. Specifically, between importing sqlalchemy (0.7.9, from tarball, also 0.8.0b1) as a directory structure and as compiled, the uncompiled version works perfectly, whereas the compiled version appears to have standard library issues:

SQLAlchemy works on IronPython? I didn't know that. Very cool. Is
there anything that has to be done or does it just work out of the
box?

>
> (in SQLAlchemy-ver/lib/ in the source tarball, and on msys bash)
> $ find 'sqlalchemy' -name "*.py" > sqlalchemy.list
> $ pyc /out:SQLAlchemy @sqlalchemy.list
> $ ipy
> IronPython 2.7.3 (2.7.0.40) on .NET 4.0.30319.17929 (32-bit)
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import clr
>>>> clr.AddReferenceToFileAndPath("SQLAlchemy.dll")
>>>> import sqlalchemy
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "sqlalchemy\__init__.py", line 52, in <module>
>   File "sqlalchemy\types", line 27, in <module>
>   File "sqlalchemy\schema", line 2670, in <module>
>   File "sqlalchemy\schema", line 2706, in DDLElement
>   File "sqlalchemy\util\deprecations", line 45, in decorate
>   File "sqlalchemy\util\deprecations", line 116, in _decorate_with_warning
>   File "sqlalchemy\util\langhelpers", line 41, in decorate
>   File "c:\Program Files\IronPython 2.7\Lib\inspect.py", line 814, in getargspec
>   File "c:\Program Files\IronPython 2.7\Lib\inspect.py", line 758, in getargs
> IndexError: index out of range: 2
>
> Does anyone have any idea how I can track this down?

In inspect.py, just before line 758, it looks at co.co_argcount and
co.co_varnames and assumes that they are the same length, but my guess
is that they might not be when compiled with pyc. If you can figure
out exactly what getargspec is being called on, that might help make a
simpler reproduction that I can work off of.

- Jeff


More information about the Ironpython-users mailing list