I have compiled the Bandup software using this command : ./build -compiler gfortran. After that, I tried to follow the tutorial inside the directory bandup-master/tutorial/VASP/example_2_bulk_Si. The second step gave me this error:

Traceback (most recent call last):
  File "/home/e/bjm42/bin/bandup", line 73, in <module>
  File "/home/e/bjm42/source/bandup/src/python_interface/bandupy/runners.py", line 73, in run_requested_task
  File "/home/e/bjm42/source/bandup/src/python_interface/bandupy/runners.py", line 54, in run_pre_bandup_tool
TypeError: write() argument must be str, not bytes

Do you know how to solve it? Can I unfold bandstructure directly with Bandup without going through the steps mentionned in the tutorial?

  • 3
    $\begingroup$ This is a common error seen when running Python 2.7 code using Python 3.X. Since Bandup seems to only be supported for Python 2.7 you will either need to install this or edit the source code in various places to make it 3.X compatible. $\endgroup$
    – Tyberius
    Commented Mar 17, 2021 at 15:35

1 Answer 1


I think your problem was solved in this pull request.

It is not merged yet because it breaks backward compatibility with python3.6 and lower. But if you use 3.7 or higher, you may try to install from that PR, and it should work. If it does not, please report the problem in the comments to that pull request.

You can also ask questions related to the Bandup code on Github in the Issues and in the Comments on Pull Requests in the corresponding repository. That place is now actively monitored by the developers (including me) and other users.

  • 2
    $\begingroup$ +10 and welcome to this community Stepan! How did you find this question about BandUP so quickly? There's been developers in the past who have tried to get peolpe here to ask questions on their own GitHub page or website, but with more than 15 million users on Stack Exchange, there might always be people preferring to ask here: For example MATLAB has it's own Q/A website called "MATLAB Answers" but there's still so many MATLAB questions asked on StackOverflow. $\endgroup$ Commented Mar 19, 2021 at 23:34
  • 1
    $\begingroup$ You might consider getting emails when the BandUP tag (mattermodeling.stackexchange.com/questions/tagged/bandup) is used. The instructions on how to do that are here: mattermodeling.meta.stackexchange.com/q/59/5. $\endgroup$ Commented Mar 19, 2021 at 23:35
  • 2
    $\begingroup$ Actually my colleague pointed me to this question. Thanks for comparing BandUP with MATLAB, but I am afraid that we have less users by a few orders. Asking here of course makes sense, because the problem may be not specific to the particular code, but more general. Yes, I subscribed to the bandup tag, but not many (of a few hundred) users of BandUP will do it. $\endgroup$ Commented Mar 22, 2021 at 13:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .