[Python-porting] Installing different files on Python 2/3

Guido van Rossum guido at python.org
Thu Jul 17 19:41:23 CEST 2014


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
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-porting/attachments/20140717/e9d389ee/attachment.html>


More information about the Python-porting mailing list