Python Forum
error using geoGen package from GITHUB
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
error using geoGen package from GITHUB
#1
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
Reply
#2
please post full traceback verbatim in error tags
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#4
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
Reply
#5
the fix for this would be
label = next(_file).split(',')
I would suggest to try and use 2to3 tool.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  qpython package error Creepy 4 942 Jul-06-2023, 05:58 PM
Last Post: Creepy
  countryinfo package error MarcusAurelius 4 2,773 Mar-20-2021, 05:42 PM
Last Post: deanhystad
  error with netcdf4 package damdam 0 1,791 Nov-18-2020, 06:44 PM
Last Post: damdam
  Importing module from a package results in import error goghvv 2 2,340 Mar-27-2020, 07:13 PM
Last Post: goghvv
  Beginner - simple package installation error mefeng2008 0 1,697 Mar-13-2020, 09:17 AM
Last Post: mefeng2008
  Error importing package julio2000 3 3,708 Jan-26-2020, 06:15 PM
Last Post: buran
  Error in importing package in pycharm fullstop 0 2,314 Dec-12-2019, 04:03 PM
Last Post: fullstop
  package(s) error pykdtree zahid990170 0 2,183 Mar-21-2019, 06:18 PM
Last Post: zahid990170
  Error while importing my own package giu88 4 2,911 Sep-19-2018, 12:18 PM
Last Post: giu88
  Countryinfo package charmap error mkaru 6 7,191 Sep-16-2018, 02:58 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020