Unqualified exec is not allowed in function '_parse_config'


#1

trying to install indico dev on centos 7 machine as non root user. got right to indico db prepare and got the following error - new to this so as much help as I can get would be really appreciated

Indico has been configured successfully!
You can now run indico db prepare to initialize your Indico database
(env) [centosdev@centos src]$ indico db prepare
.

File "/home/centosdev/dev/indico/src/indico/legacy/common/cache.py", line 27, in <module>
    from indico.core.config import config
  File "/home/centosdev/dev/indico/src/indico/core/config.py", line 153
    exec(compile(config_file.read(), path, 'exec'), globals_, locals_)
SyntaxError: unqualified exec is not allowed in function '_parse_config' it contains a nested function with free variables

#2

Which Python version are you using? python --version


#3

I am using version 2.7


#4

Could you please show the full version? On 2.7.15 it’s working fine for me.


#5

(env) [centosdev@centos src]$ python --version
Python 2.7.5
(env) [centosdev@centos src]$


#6

Can you try replacing this line:

exec(compile(config_file.read(), path, 'exec'), globals_, locals_)

with this?

exec compile(config_file.read(), path, 'exec') in globals_, locals_

#7

Ok - will give that ago - in config.py I assume - will let you know how I get on…


#8

Thanks - that has worked so will now carry on to next step… again, thanks.


#9

Thanks, I just pushed a fix so please update to the latest master.