tkluck / pyperler

Use perl scripts and libraries from Python
GNU General Public License v3.0
19 stars 2 forks source link

AttributeError: 'RuntimeError' object has no attribute 'message' #2

Closed ByReaL closed 4 years ago

ByReaL commented 4 years ago

I know I can install Table and move on but I see this problem AttributeError: 'RuntimeError' object has no attribute 'message' I tried to modify the code and instead of e.message to use e.msg and few other fixes but I was not able to fix on my own.

https://www.python.org/dev/peps/pep-0352/

[pyperler]# python Python 3.8.1 (default, Dec 21 2019, 20:57:38) [GCC 9.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import pyperler; i = pyperler.Interpreter() Table = i.use('Text::Table') Traceback (most recent call last): File "pyperler.pyx", line 720, in pyperler.PerlPackage.init interpreter('use ' + name) File "pyperler.pyx", line 606, in pyperler.Interpreter.call return self._eval(expression, perl.G_SCALAR) File "pyperler.pyx", line 592, in pyperler.Interpreter._eval raise RuntimeError(perl.SvPVutf8_nolen(perl.ERRSV).decode()) RuntimeError: Can't locate Text/Table.pm in @INC (you may need to install the Text::Table module) (@INC contains: /usr/lib/perl5/5.30/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/5.30/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/5.30/core_perl /usr/share/perl5/core_perl) at (eval 8) line 1. BEGIN failed--compilation aborted at (eval 8) line 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "pyperler.pyx", line 660, in pyperler.Interpreter.getattribute.perl_package_constructor return PerlPackage(self, *args, **kwds) File "pyperler.pyx", line 722, in pyperler.PerlPackage.init raise ImportError("Could not import Perl package %s: %s" % (self._name, e.msg)) AttributeError: 'RuntimeError' object has no attribute 'message'

tkluck commented 4 years ago

Thanks for reporting! I'm assuming you're using Python 3? It looks like the field msg on a RuntimeError has been replaced by a tuple args. I'll update the code and add a test.

While I'm at it, I'll set PYTHON=python3 by default in the Makefile as that's a bit overdue. Expect both these changes hopefully soon.