Encoding error passing the path, how can i solve it?

-1
     path = self.loadProjectfile()
       with open(path, 'r', encoding='utf8') as rf:
          print('OK')

I cannot put the 'r' before the path to solve the issue, what can I do ? With the 'r' before it works ... I get an error like this

Process finished with exit code -1073740791 (0xC0000409)

This is the function

    def loadProjectfile(self):
       support = []

       with open('progetto.txt', 'r') as rf:
         lines = rf.readlines()
         for line in lines:
            support.append(line.strip())
         country_league = support[0].split(',')
         country = country_league[0][0:3]
         country = country.upper()

         league = country_league[1]
         league = league.replace(' ', '')
         league = league.capitalize()
         years = support[1]
         season = years[2:5] + years[7:]
         research = league + season

         firstpartoffile = 'C:\\Users\\Utente\\PycharmProjects\\Football\\'
         researchfile = firstpartoffile + country + '\\' + league + '\\' + research + 'Games.csv'

     return researchfile 
python
asked on Stack Overflow May 3, 2020 by Al Pan • edited May 3, 2020 by Al Pan

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0