[Python-porting] Installing different files on Python 2/3
Shai Berger
shai at platonix.com
Thu Jul 17 22:23:02 CEST 2014
I think Dirkjan tried to replace the invocation of util.pyexec with an exec;
keeping the invocation, and replacing the python2 implementation, should work.
Shai.
On Thursday 17 July 2014 10:41:23 Guido van Rossum wrote:
> The code you link to doesn't match the traceback. I recommend that you
> experiment a bit and Google around for the error message.
>
>
> On Thu, Jul 17, 2014 at 10:25 AM, Dirkjan Ochtman <dirkjan at ochtman.nl>
>
> wrote:
> > On Thu, Jul 17, 2014 at 5:45 PM, Guido van Rossum <guido at python.org>
> >
> > wrote:
> > > The Py2 version can just call exec(code, gns, lns). It is Py2 syntax
> > > too!
> >
> > That sounds like an awesome solution, but it doesn't quite solve the
> > problem:
> >
> > Traceback (most recent call last):
> > File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
> >
> > "__main__", fname, loader, pkg_name)
> >
> > File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
> >
> > exec code in run_globals
> >
> > File "/home/djc/src/couchdb-python/couchdb/tests/__main__.py", line
> >
> > 11, in <module>
> >
> > from couchdb.tests import client, couch_tests, design, couchhttp, \
> >
> > File "couchdb/tests/view.py", line 12, in <module>
> >
> > from couchdb import view
> >
> > File "couchdb/view.py", line 56
> >
> > exec(string, {'log': _log}, globals_)
> >
> > SyntaxError: unqualified exec is not allowed in function 'add_fun' it
> > is a nested function
> >
> > The code is here:
> >
> > https://github.com/djc/couchdb-python/blob/afdbe601/couchdb/view.py#L56
> >
> > I read up a little on unqualified and qualified exec, but I couldn't
> > really figure out why that error is triggering in this case.
> >
> > Cheers,
> >
> > Dirkjan
More information about the Python-porting
mailing list