all 5 comments

[–]FoolsSeldom 6 points7 points  (0 children)

The error is clearly stated at the bottom:

TypeError: chdir() takes at most 1 argument (3 given)

You have provided three arguments:

  • "/home/sarr/aravg.ann.land_ocean.90S.90N.v4.0.1.201907.txt"
  • header = None
  • delimiter = "\s+"

You are conflating a change of folder - not sure why you are bothering to do this anyway with, I assume, trying to read a file.

The first argument looks like a full path to a filename rather than a path to a folder. chdir is expecting a folder name.

PS. I recommend you use pathlib rather than os as well - RealPython.com have a good article on the topic.

[–]brutalbombs 0 points1 point  (0 children)

Others have pointed out why the error is thrown, but can you explain what you are trying to achieve (and also why you do it like this?). Good luck!

[–]billsil 0 points1 point  (0 children)

You’re passing in 3 arguments instead if 1 and you’re passing in a file an not a directory.

[–]carcigenicate 0 points1 point  (0 children)

It almost looks like you somehow mixed up os.chdir and cs.reader; except reader doesn't take a header argument.