Python Scripts Not Working

Hi everyone,

I am using exciting oxygen on Ubuntu 20.04.1. The exciting package calculations seem to work fine, however when trying to plot the calculations with the python scripts in $EXCITINGROOT/tools I get errors. For example, following the q-dependent TDDFT tutorial for Ag lead to the calculation finishing fine.
Using the command " --kernel LOSS_FXCRPA_QMT002.OUT LOSS_NLF_FXCRPA_QMT002.OUT "
lead to the following error:
File $EXCITINGROOT/tools/, line 47 print "Error: file "s\" doesn't exist!\n"(i)
SyntaxError: invalid syntax

This was due to the wrong syntax for the print function, so I placed all parentheses on all print functions, and changed the top of the file to #!/usr/bin/python3
However, then a different error appeared:

Traceback (most recent call last):
File “$EXCITINGROOT/Tools/”, line 29, in
rundir = shell_value(‘EXCITINGRUNDIR’,ev_list,current)[0]
File “$EXCITINGROOT/tools/”, line 21, in shell_value
if ( vlist[i] == variable ): v = os.environ[variable] ; e = True ; break
TypeError: ‘KeysView’ object is not subscriptable

I’m thinking that this may be due to my python version (3.8.10) and the scripts in #EXCTINGROOT/tools. How can I fix this? (would prefer not having to write all the scripts from scratch)


Hi Luigi,

It’s not a syntax error in print or the shebang, it’s python2. The scripts are unfortunately a mix.
Ubuntu 20.04.1 is python3 by default, just apt-get python2.


Hi Alex,

Installing python2 led to the message: /usr/bin/python: bad interpreter: No such file or directory/.
Changing the shebang to python2 also did not help. I also tried reinstalling exciting from scratch after the python2 installation, but that did not work.


There’s no reason to think rebuilding exciting would fix this, it’s a python env problem.
which python2 should indicate the path for the shebang, but you can alternatively just remove it and run with:

I note that when I do this, I get a problem with matplotlib:

ImportError: No module named style

which probably means the version I have is incompatible with this script. The cleanest thing to do is install the dependencies + python2 in a venv, or just modify this script. It only parses and plots, and there’s nothing special about the plotting.

I note that these scripts are gradually getting refactored, but it’s not likely to be in the next release.