[elbe-devel] [PATCH] debianize: call DebianizeBase.__init__() after setting attributes to None

Kurt Kanzenbach kurt at linutronix.de
Mon Oct 8 17:14:56 CEST 2018


Hi Torben,

On Mon, Oct 08, 2018 at 05:09:16PM +0200, Torben Hohn wrote:
> gui() seems to be called from FormMultiPage.__init__() via
> DebianizeBase.create() after that, the self.loadaddr and friends are
> set to None. This fails of course.
>
> ------------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/home/torbenh/elbe/elbe/elbe", line 55, in <module>
>     cmdmod.run_command(sys.argv[2:])
>   File "/home/torbenh/elbe/elbe/elbepack/commands/debianize.py", line 22, in run_command
>     Debianize(debianizer).run()
>   File "/usr/lib/python2.7/dist-packages/npyscreen/apNPSApplication.py", line 30, in run
>     return npyssafewrapper.wrapper(self.__remove_argument_call_main)
>   File "/usr/lib/python2.7/dist-packages/npyscreen/npyssafewrapper.py", line 41, in wrapper
>     wrapper_no_fork(call_function)
>   File "/usr/lib/python2.7/dist-packages/npyscreen/npyssafewrapper.py", line 97, in wrapper_no_fork
>     return_code = call_function(_SCREEN)
>   File "/usr/lib/python2.7/dist-packages/npyscreen/apNPSApplication.py", line 25, in __remove_argument_call_main
>     return self.main()
>   File "/usr/lib/python2.7/dist-packages/npyscreen/apNPSApplicationManaged.py", line 172, in main
>     self._THISFORM.edit()
>   File "/usr/lib/python2.7/dist-packages/npyscreen/fm_form_edit_loop.py", line 47, in edit
>     self.edit_loop()
>   File "/usr/lib/python2.7/dist-packages/npyscreen/fm_form_edit_loop.py", line 38, in edit_loop
>     self._widgets__[self.editw].edit()
>   File "/usr/lib/python2.7/dist-packages/npyscreen/wgwidget.py", line 458, in edit
>     self._edit_loop()
>   File "/usr/lib/python2.7/dist-packages/npyscreen/wgwidget.py", line 474, in _edit_loop
>     self.get_and_use_key_press()
>   File "/usr/lib/python2.7/dist-packages/npyscreen/wgwidget.py", line 610, in get_and_use_key_press
>     self.handle_input(ch)
>   File "/usr/lib/python2.7/dist-packages/npyscreen/wgwidget.py", line 71, in handle_input
>     self.handlers[_input](_input)
>   File "/usr/lib/python2.7/dist-packages/npyscreen/wgbutton.py", line 97, in h_toggle
>     self.when_pressed_function()
>   File "/home/torbenh/elbe/elbe/elbepack/debianize/base.py", line 121, in on_ok
>     self.debianize()
>   File "/home/torbenh/elbe/elbe/elbepack/debianize/kernel.py", line 71, in debianize
>     self.deb['loadaddr'] = self.loadaddr.get_value()
> AttributeError: 'NoneType' object has no attribute 'get_value'
> ------------------------------------------------------------------------
>
> move the call to DebianizeBase.__init__() below attribute initialisation.
>
> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>

Tested-by: Kurt Kanzenbach <kurt at linutronix.de>

it solves the issue for me.

Thanks,
Kurt

> ---
>  elbepack/debianize/barebox.py | 4 ++--
>  elbepack/debianize/kernel.py  | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/elbepack/debianize/barebox.py b/elbepack/debianize/barebox.py
> index ff9d70dc..90cb51df 100644
> --- a/elbepack/debianize/barebox.py
> +++ b/elbepack/debianize/barebox.py
> @@ -22,13 +22,13 @@ class BareBox (DebianizeBase):
>      files = ['Kbuild', 'Kconfig', 'README', 'TODO']
>
>      def __init__(self):
> -        DebianizeBase.__init__(self)
> -
>          self.defconfig = None
>          self.imgname = None
>          self.cross = None
>          self.k_version = None
>
> +        DebianizeBase.__init__(self)
> +
>      def gui(self):
>          self.defconfig = self.add_widget_intelligent(
>              TitleText, name="defconfig:", value="imx_v7_defconfig")
> diff --git a/elbepack/debianize/kernel.py b/elbepack/debianize/kernel.py
> index 3aeda851..227985a3 100644
> --- a/elbepack/debianize/kernel.py
> +++ b/elbepack/debianize/kernel.py
> @@ -26,13 +26,13 @@ class Kernel (DebianizeBase):
>      def __init__(self):
>          self.imgtypes = ["bzImage", "zImage", "uImage", "Image"]
>          self.imgtypes_install = ["install", "zinstall", "uinstall", "install"]
> -        DebianizeBase.__init__(self)
>
>          self.loadaddr = None
>          self.defconfig = None
>          self.imgtype = None
>          self.cross = None
>          self.k_version = None
> +        DebianizeBase.__init__(self)
>
>      def gui(self):
>          self.loadaddr = self.add_widget_intelligent(
> --
> 2.11.0
>
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel



More information about the elbe-devel mailing list