Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError with git versions #2442

Closed
konstin opened this issue Aug 23, 2016 · 12 comments
Closed

AttributeError with git versions #2442

konstin opened this issue Aug 23, 2016 · 12 comments
Labels

Comments

@konstin
Copy link
Contributor

konstin commented Aug 23, 2016

I've followed http://www.unknown-horizons.org/download/sources/s-linux/, and here's what I get for the last step:

$ ./setup.py build_i18n && ./run_uh.py
running build_i18n
intltool-merge -d po/uh/ content/packages/unknown-horizons.desktop.in build/share/applications/unknown-horizons.desktop
Merging translations into build/share/applications/unknown-horizons.desktop.
Traceback (most recent call last):
  File "./run_uh.py", line 380, in <module>
    main()
  File "./run_uh.py", line 185, in main
    import horizons.main
  File "/home/konsti/unknown-horizons/horizons/main.py", line 45, in <module>
    from horizons.gui import Gui
  File "/home/konsti/unknown-horizons/horizons/gui/__init__.py", line 22, in <module>
    from gui import Gui
  File "/home/konsti/unknown-horizons/horizons/gui/gui.py", line 36, in <module>
    from horizons.gui.modules.editorstartmenu import EditorStartMenu
  File "/home/konsti/unknown-horizons/horizons/gui/modules/__init__.py", line 26, in <module>
    from singleplayermenu import SingleplayerMenu
  File "/home/konsti/unknown-horizons/horizons/gui/modules/singleplayermenu.py", line 34, in <module>
    from horizons.world import load_raw_world  # FIXME placing this import at the end results in a cycle
  File "/home/konsti/unknown-horizons/horizons/world/__init__.py", line 31, in <module>
    from horizons.world.island import Island
  File "/home/konsti/unknown-horizons/horizons/world/island.py", line 34, in <module>
    from horizons.world.settlement import Settlement
  File "/home/konsti/unknown-horizons/horizons/world/settlement.py", line 37, in <module>
    from horizons.world.resourcehandler import ResourceHandler
  File "/home/konsti/unknown-horizons/horizons/world/resourcehandler.py", line 24, in <module>
    from horizons.gui.tabs import ProductionOverviewTab, InventoryTab
  File "/home/konsti/unknown-horizons/horizons/gui/tabs/__init__.py", line 33, in <module>
    from shiptabs import ShipOverviewTab, FightingShipOverviewTab, \
  File "/home/konsti/unknown-horizons/horizons/gui/tabs/shiptabs.py", line 29, in <module>
    from horizons.gui.widgets.routeconfig import RouteConfig
  File "/home/konsti/unknown-horizons/horizons/gui/widgets/routeconfig.py", line 32, in <module>
    from horizons.gui.widgets.minimap import Minimap
  File "/home/konsti/unknown-horizons/horizons/gui/widgets/minimap.py", line 38, in <module>
    class Minimap(object):
  File "/home/konsti/unknown-horizons/horizons/gui/widgets/minimap.py", line 82, in Minimap
    _dummy_fife_point = fife.Point(0, 0) # use when you quickly need a temporary point
  File "/usr/lib/python2.7/dist-packages/fife/fife.py", line 5639, in __init__
    self.this.append(this)
  File "/usr/lib/python2.7/dist-packages/fife/fife.py", line 5619, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Point, name)
  File "/usr/lib/python2.7/dist-packages/fife/fife.py", line 74, in _swig_getattr
    return _swig_getattr_nondynamic(self, class_type, name, 0)
  File "/usr/lib/python2.7/dist-packages/fife/fife.py", line 69, in _swig_getattr_nondynamic
    return object.__getattr__(self, name)
AttributeError: type object 'object' has no attribute '__getattr__'
@jorgesumle
Copy link
Contributor

I've installed it on Trisquel today (an Ubuntu-based distribution) and worked fine. Maybe this video helps you: https://goblinrefuge.com/mediagoblin/u/freakspot/m/instalacion-de-unknown-horizons-a-partir-del-codigo-fuente/. Tell us which fifechan and fifengine version are currently installed. --version I think should output that, but I'm not sure. Maybe, you can help with this @LinuxDonald.

@LinuxDonald
Copy link
Member

I dont know the command for version info. What i can say is that UH Git version only runs with fife git and fifechan git version. And not with the last stable release of fife.

@MasterofJOKers
Copy link
Contributor

python -c 'from fife import fife; print fife.getVersion()' returns 0.4.0 for me.

On Debian, one could run dpkg -l | grep -i fife to see the package version if installed. If you haven't built your own package, that should return nothing. Otherwise, you probably have the old 0.3.5 version from Debian repositories.

@konstin
Copy link
Contributor Author

konstin commented Aug 25, 2016

Here's the output of those commands:

$ python -c 'from fife import fife; print fife.getVersion()'
0.4.0+39e8b513
$~/unknown-horizons: dpkg -l | grep -i fife
$~/unknown-horizons:

@MasterofJOKers
Copy link
Contributor

so ... basically, the following does not work for you?
python -c 'from fife import fife; fife.Point(0, 0)'

Could you please run python -c 'from fife import fife; print fife._newclass' and tell me, if it prints 1 or 0?

@MasterofJOKers
Copy link
Contributor

Could you please open "/usr/lib/python2.7/dist-packages/fife/fife.py" and tell me, whats in line 5640 and 5641? The file generated for me should not be able to exhibit the same behaviour as yours. What version of swig did you use? (dpkg -l | grep -i swig)

@konstin
Copy link
Contributor Author

konstin commented Aug 25, 2016

$ python -c 'from fife import fife; fife.Point(0, 0)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/fife/fife.py", line 5639, in __init__
    self.this.append(this)
  File "/usr/lib/python2.7/dist-packages/fife/fife.py", line 5619, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Point, name)
  File "/usr/lib/python2.7/dist-packages/fife/fife.py", line 74, in _swig_getattr
    return _swig_getattr_nondynamic(self, class_type, name, 0)
  File "/usr/lib/python2.7/dist-packages/fife/fife.py", line 69, in _swig_getattr_nondynamic
    return object.__getattr__(self, name)
AttributeError: type object 'object' has no attribute '__getattr__'
$ python -c 'from fife import fife; print fife._newclass'
1
$ dpkg -l | grep -i swig
ii  swig                                          3.0.8-0ubuntu3                                              amd64        Generate scripting interfaces to C/C++ code
ii  swig3.0                                       3.0.8-0ubuntu3                                              amd64        Generate scripting interfaces to C/C++ code

Lines 5640 - 5641 for /usr/lib/python2.7/dist-packages/fife/fife.py:

        except Exception:
            self.this = this

@MasterofJOKers
Copy link
Contributor

This makes no sense to me. Your AttributeError should be catched by that except right there:

>>> object.__getattr__()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'object' has no attribute '__getattr__'
>>> try:
...  object.__getattr__()
... except Exception:
...  print "shiny"
... 
shiny
>>> try:
...  object.__getattr__()
... except BaseException:
...  print "shiny"
... 
shiny

On the other hand, if I change my line (which is just except:) to yours, I get the same error. except BaseException: works, too. You should probably re-build fife with the swig2.0 package installed instead of swig3.0.

@MasterofJOKers
Copy link
Contributor

So it seems to be partly fife's fault for having an own Exception class. swig/swig#584 fixes this, which is in swig 3.0.9.

@konstin
Copy link
Contributor Author

konstin commented Aug 26, 2016

I've manually installig swig 3.0.10. The game now finally works. Though I'm not really satisfied with this solution as you normally don't want to build 4 projects from source just to play a game.

@MasterofJOKers
Copy link
Contributor

Totally understandable. We are working on a new release and on nightly builds.

@squiddy
Copy link
Member

squiddy commented Oct 10, 2016

I think we can close this one. Looks like an issue with swig 3.0.8 specifically: swig/swig#583

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants