ptomato / Beams

Open-source laser beam profiling software designed for cheap webcams
MIT License
23 stars 13 forks source link

KeyError: 'beams/icons/about.png' #1

Closed fromagek closed 9 years ago

fromagek commented 10 years ago

i get the following error when i try to stat beams:

notebook:~$ beams 
Traceback (most recent call last):
  File "/usr/local/bin/beams", line 9, in <module>
    load_entry_point('Beams==0.9.rc3', 'gui_scripts', 'beams')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
    ['__name__'])
  File "build/bdist.linux-x86_64/egg/beams/__init__.py", line 1, in <module>
    #
  File "build/bdist.linux-x86_64/egg/beams/MainWindow.py", line 17, in <module>
  File "build/bdist.linux-x86_64/egg/beams/CameraDialog.py", line 35, in <module>
  File "build/bdist.linux-x86_64/egg/beams/CameraDialog.py", line 45, in CameraDialog
  File "build/bdist.linux-x86_64/egg/beams/IconFinder.py", line 27, in find_icon
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 954, in resource_filename
    self, resource_name
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1652, in get_resource_filename
    return self._extract_resource(manager, zip_path)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1673, in _extract_resource
    timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
KeyError: 'beams/icons/about.png'
ptomato commented 10 years ago

What Python distribution are you using and on what system? At first glance this might be new behavior of pkg_resources; for me it doesn't raise an exception if the file isn't found.

fromagek commented 10 years ago

I tryed it on two systems. One was Linux mint Quiana, the other Debian testing:

florian@flori-notebook:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux testing (jessie)
Release:    testing
Codename:   jessie

florian@flori-notebook:~$ uname -a
Linux flori-notebook 3.14-2-amd64 #1 SMP Debian 3.14.15-2 (2014-08-09) x86_64 GNU/Linux

florian@flori-notebook:~$ python --version
Python 2.7.8

Not shure was Python distribution means. I just installed Python/spyder from the Ubuntu/Debian repos. I think python version was the same on both systems.

I tryed https://stackoverflow.com/questions/7446187/no-module-named-pkg-resources

Setuptools version 0.6c11 or greater has been installed.

but it didn't solve the problem.

ptomato commented 10 years ago

OK, I will try it on Debian and see if I can figure out what is going on.

dtaviation commented 10 years ago

fromage88,

I don't know python, and I don't know the Beams code, but after having the same problem, I checked for files like "about.png"

Stock distribution:

$ find ./ -name "*png" -exec ls -lat {} \; -rw-rw-r-- 1 dave dave 679 Mar 23 2014 ./beams/icons/stock_about.png -rw-rw-r-- 1 dave dave 701 Mar 23 2014 ./beams/icons/camera-video.png -rw-rw-r-- 1 dave dave 911 Mar 23 2014 ./beams/icons/stock_save.png -rw-rw-r-- 1 dave dave 781 Mar 23 2014 ./beams/icons/gtk-quit.png -rw-rw-r-- 1 dave dave 464 Mar 23 2014 ./beams/icons/stock_properties.png -rw-rw-r-- 1 dave dave 864 Mar 23 2014 ./beams/icons/camera-photo.png

$ grep find_icon MainWindow.py from IconFinder import find_icon image=find_icon('about'), image=find_icon('save'), image=find_icon('quit'), image=find_icon('camera-video'), image=find_icon('camera-photo'),

Since about.png, save.png, and quit.png did not exist in the distribution, I created files with those names by copying the existing files, for example copying stock_about.png to about.png.

That solved the "KeyError" problem.

fromagek commented 9 years ago

Hey dtaviation thanks for your hint. That seemed to work for me too. Unfortunately I am stuck with the following error now:

florian@flori-notebook:~/tmp/Beams$ beams
Traceback (most recent call last):
  File "/usr/local/bin/beams", line 9, in <module>
    load_entry_point('Beams==0.9.rc3', 'gui_scripts', 'beams')()
  File "/home/florian/tmp/Beams/beams/MainWindow.py", line 192, in main
    mainwin.configure_traits()
  File "/usr/local/lib/python2.7/dist-packages/traits-4.5.0-py2.7-linux-x86_64.egg/traits/has_traits.py", line 2156, in configure_traits
    kind, handler, id, scrollable, args )
  File "/usr/local/lib/python2.7/dist-packages/traitsui-4.4.0-py2.7.egg/traitsui/wx/toolkit.py", line 219, in view_application
    id, scrollable, args )
  File "/usr/local/lib/python2.7/dist-packages/traitsui-4.4.0-py2.7.egg/traitsui/wx/view_application.py", line 93, in view_application
    scrollable, args ).ui.result
  File "/usr/local/lib/python2.7/dist-packages/traitsui-4.4.0-py2.7.egg/traitsui/wx/view_application.py", line 141, in __init__
    super( ViewApplication, self ).__init__(0)
  File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_core.py", line 8628, in __init__
    self._BootstrapApp()
  File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_core.py", line 8196, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/traitsui-4.4.0-py2.7.egg/traitsui/wx/view_application.py", line 158, in OnInit
    args       = self.args )
  File "/usr/local/lib/python2.7/dist-packages/traitsui-4.4.0-py2.7.egg/traitsui/view.py", line 433, in ui
    ui.ui( parent, kind )
  File "/usr/local/lib/python2.7/dist-packages/traitsui-4.4.0-py2.7.egg/traitsui/ui.py", line 221, in ui
    self.rebuild( self, parent )
  File "/usr/local/lib/python2.7/dist-packages/traitsui-4.4.0-py2.7.egg/traitsui/wx/toolkit.py", line 140, in ui_live
    ui_live.ui_live( ui, parent )
  File "/usr/local/lib/python2.7/dist-packages/traitsui-4.4.0-py2.7.egg/traitsui/wx/ui_live.py", line 68, in ui_live
    ui_dialog( ui, parent, NONMODAL )
  File "/usr/local/lib/python2.7/dist-packages/traitsui-4.4.0-py2.7.egg/traitsui/wx/ui_live.py", line 99, in ui_dialog
    ui.owner.init( ui, parent, style )
  File "/usr/local/lib/python2.7/dist-packages/traitsui-4.4.0-py2.7.egg/traitsui/wx/ui_live.py", line 299, in init
    self.add_menubar()
  File "/usr/local/lib/python2.7/dist-packages/traitsui-4.4.0-py2.7.egg/traitsui/wx/ui_base.py", line 199, in add_menubar
    menubar.create_menu_bar( self.control, self ) )
  File "/usr/local/lib/python2.7/dist-packages/pyface-4.4.0-py2.7.egg/pyface/ui/wx/action/menu_bar_manager.py", line 49, in create_menu_bar
    menu = item.create_menu(parent, controller)
  File "/usr/local/lib/python2.7/dist-packages/pyface-4.4.0-py2.7.egg/pyface/ui/wx/action/menu_manager.py", line 58, in create_menu
    return _Menu(self, parent, controller)
  File "/usr/local/lib/python2.7/dist-packages/pyface-4.4.0-py2.7.egg/pyface/ui/wx/action/menu_manager.py", line 110, in __init__
    self.refresh()
  File "/usr/local/lib/python2.7/dist-packages/pyface-4.4.0-py2.7.egg/pyface/ui/wx/action/menu_manager.py", line 153, in refresh
    parent, group, previous_non_empty_group
  File "/usr/local/lib/python2.7/dist-packages/pyface-4.4.0-py2.7.egg/pyface/ui/wx/action/menu_manager.py", line 208, in _add_group
    item.add_to_menu(parent, self, self._controller)
  File "/usr/local/lib/python2.7/dist-packages/pyface-4.4.0-py2.7.egg/pyface/action/action_item.py", line 103, in add_to_menu
    wrapper = _MenuItem(parent, menu, self, controller)
  File "/usr/local/lib/python2.7/dist-packages/pyface-4.4.0-py2.7.egg/pyface/ui/wx/action/action_item.py", line 93, in __init__
    self.control.SetBitmap(action.image.create_bitmap())
  File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_core.py", line 12543, in SetBitmap
    return _core_.MenuItem_SetBitmap(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "Assert failure" failed at ../src/gtk/menu.cpp(724) in SetBitmap(): only normal menu items can have bitmaps

any advice?

trygentoo commented 9 years ago

Hello,

I've got the same problem, but solution proposed by dtaviation is not working for me.

Please help!

ptomato commented 9 years ago

I'm so sorry for leaving this for so long (see #2). I've fixed the above two errors and will release a new version soon; checkout git master if you want to use it already.

@trygentoo Is it not working for you because you hit the same error as @fromage88 or is something else malfunctioning? When reporting bugs, it helps if you're very specific.

trygentoo commented 9 years ago

I get the same output in terminal as @fromage88 and tried to use solution by @dtaviation, but it doesn't help: get the same output.

Thank you.

trygentoo commented 9 years ago

Hello again,

I've tried to run version from git master, but it results in segmentation fault:

$ beams
/usr/lib64/python2.7/site-packages/traits/trait_handlers.py:1599: FutureWarning: comparison to None will result in an elementwise object comparison in the future.
  if value in self.values:
/usr/lib64/python2.7/site-packages/chaco/image_data.py:190: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  self._data = newdata
/usr/lib64/python2.7/site-packages/chaco/array_data_source.py:123: FutureWarning: comparison to None will result in an elementwise object comparison in the future.
  self._data = newdata
Segmentation fault

Hope you will find some time to check this. Thank you.

ptomato commented 9 years ago

See #3; I'm working on it.