Code Monkey home page Code Monkey logo

Comments (3)

marc-hb avatar marc-hb commented on July 22, 2024 1

Initialization is often tricky: ordering dependencies can be hard. So it's not a major surprise that some things don't work (yet) in an __init__() method. I just had a look at initializations in zephyr/scripts/west_commands/ and none of them has any logic, just constants. This should probably be better documented but: "In Rome, do as the Romans do?" I recommend you defer any logic somewhere after __init__() time.

This being said, error-handling should be better: better message and nothing should ever trigger an infinite loop/recursion.

from west.

marc-hb avatar marc-hb commented on July 22, 2024

Thanks for the report! Can you please share:

  • The west commit used
  • The one-line diff
  • Just in case, the manifest used.

from west.

yvesll avatar yvesll commented on July 22, 2024

Hi, @marc-hb , sorry my description is not quite clear. The issue happens on a west extension command and my installed west version is v1.2.0

Hook following extension command to a west project can reproduce the issue.

# example.py
from west.commands import WestCommand
class Example(WestCommand):
    def __init__(self):
        super().__init__(
          'example',
          # Keep this in sync with the string in west-commands.yml.
          'example',
          "example")
        
        # This may raise an exception
        self.err("show a log")

    def do_add_parser(self, parser_adder):
        parser = self._parser(parser_adder, epilog='')
        return parser
    
    def do_run(self, args):
        pass

from west.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.