Python Forum
error using geoGen package from GITHUB - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: error using geoGen package from GITHUB (/thread-21028.html)



error using geoGen package from GITHUB - hknarahari - Sep-11-2019

Hi,
I am a newbie (a teacher trying to use python package for teaching CFD), I have been trying to us an open domain package "https://github.com/acrovato/geoGen/blob/master/wing.py" and have been running into error messages. I am using Python 3.6 (Anaconda and Spider), I have a suspicion that it cold be due to version difference and tried to use the tool :2to3" , but it did not solve the problem. I am attaching the code snipet and error message.

def read(self,fname):
        """Read data from file and stroe in matrix
        """
        _file = file(fname)
        label = _file.next().split(',')
        _file.close()
        data = np.loadtxt(fname, skiprows=1)
        return data 
error message is in
_file = file<name>
'file' is not found

Of course the required files are there
Apologies if it is stupid question ( I am a 68 year old FORTRAN coder)
Thanks in advance
Narahari


RE: error using geoGen package from GITHUB - buran - Sep-11-2019

please post full traceback verbatim in error tags


RE: error using geoGen package from GITHUB - buran - Sep-11-2019

Looking more into it - this python2 code
on line 136 they use file() function, which was depreciated in python3
change it to _file = open(fname)
There might be other problems though


RE: error using geoGen package from GITHUB - hknarahari - Sep-17-2019

Thank you Buran. As you predicted I have found a new error :
_file = open(fname)
label = _file.next().split(',')
AttributeError : '_io.TextIOWrapper object has no attribute 'next'

Can I use 'Futerize' command to fix similar errors ? I really dont want to go back to Python 2.7 version..
Regards
Narahari


RE: error using geoGen package from GITHUB - buran - Sep-17-2019

the fix for this would be
label = next(_file).split(',')
I would suggest to try and use 2to3 tool.