band-unfolding / bandup

BandUP: Band Unfolding code for Plane-wave based calculations
http://www.ifm.liu.se/theomod/compphys/band-unfolding
GNU General Public License v3.0
98 stars 50 forks source link

Python3 compatiblity #3

Closed bjmorgan closed 2 years ago

bjmorgan commented 6 years ago

Running bandup kpts under Python3, I get the following error:

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

This looks to me like Python 3 being stricter about byte vs. string IO streams, but could be something entirely different.

fraricci commented 5 years ago

a quick solution is to replace line with line.decode()

mbagheri20 commented 3 years ago

a quick solution is to replace line with line.decode()

Hi, I used this method but it didn't work. Also, the plot step didn't work with python 3 So I used python 2.7 Is there any way to compatible the BandUP with python 3?

fraricci commented 3 years ago

Hi, I think there were other edits to do in order to get it work on Python3. I sent a pull request, you might use that code. Let me know if it works.

Chikou24i commented 3 years ago

I have also faced the same issue. Could you please help me ?

fraricci commented 3 years ago

Try to clone and install my fork that include the needed edit to be py3 compatible.

Chikou24i commented 3 years ago

When I run : ./build I get this at the end :

cd spglib-1.5.2;\ ./configure FC=ifort CC=icc CFLAGS=-openmp FCFLAGS=-openmp;\ cd /home/ouettar/Downloads/bandup-master (1)/bandup-master/src/external /bin/sh: 3: Syntax error: "(" unexpected Makefile:17: recipe for target 'spglib-1.5.2/Makefile' failed make: [spglib-1.5.2/Makefile] Error 2 /bin/sh: 1: Syntax error: "(" unexpected /bin/sh: 1: Syntax error: "(" unexpected /bin/sh: 1: Syntax error: "(" unexpected /bin/sh: 1: Syntax error: "(" unexpected /bin/sh: 1: Syntax error: "(" unexpected make: No rule to make target 'kinds.o', needed by 'cla.o'. Stop.

stepan-tsirkin commented 3 years ago

dear @Chikou24i , the problem that you are facing happens only with the PR #7 from @fraricci , or with the master branch of bandup also ?

I think the reason is that it is assumed that /bin/sh is assumed to point to bash , but probably on your system it does not . What is your system and what is your default shell?

stepan-tsirkin commented 2 years ago

fixed in #21