NameError: name 'basestring' is not defined in example script
Khary Richardson
30 Apr '15
Hello,
When trying to run the first API example in the example scrips I get the following error
File "C:\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages\illustris_python\groupcat.py", line 20, in loadObjects
if isinstance(fields, basestring):
NameError: name 'basestring' is not defined
I looked in the groupcat file and it indeed looks as if basestring is never definded.
Thank you
Dylan Nelson
1 May '15
Hi Khary,
Seems this is a Python 3 issue (the examples were developed in Python 2).
or you can just delete these two lines of the script, so long as you understand what they are protecting you against. In particular, that fields=["Masses","Coordinates"] and fields=["Masses"] are ok, but fields="Masses" is going to cause problems.
Hello, When trying to run the first API example in the example scrips I get the following error
File "C:\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages\illustris_python\groupcat.py", line 20, in loadObjects if isinstance(fields, basestring):
NameError: name 'basestring' is not defined
I looked in the groupcat file and it indeed looks as if basestring is never definded.
Thank you
Hi Khary,
Seems this is a Python 3 issue (the examples were developed in Python 2).
You can implement the fix described at
or you can just delete these two lines of the script, so long as you understand what they are protecting you against. In particular, that
fields=["Masses","Coordinates"]
andfields=["Masses"]
are ok, butfields="Masses"
is going to cause problems.The fix linked above worked perfectly. Thank You!