Does anyone ever try the HelloWorld example?

17 views
Skip to first unread message

irsysint...@gmail.com

unread,
Jul 1, 2017, 1:23:58 AM7/1/17
to circuits


It does not work, at least on Debian. The App().started method calls raise SystemExit(0), so App().hello does not even get a chance to execute.

It seems to me that raise SystemExit(0) should be called inside App().hello instead, after it prints out the words.


James Mills

unread,
Jul 1, 2017, 1:28:48 AM7/1/17
to circuit...@googlegroups.com
Yeah you're probably right and the example is probably just racey :D

Send a PR and we'll merge it!

cheers
James

irsysint...@gmail.com

unread,
Jul 1, 2017, 9:01:45 PM7/1/17
to circuits

One of the Hello.py is fixed. But there are two places still need to be fixed:
1. The Hello World! example in the home page of http://circuitsframework.com might be the important one to fix.
2. The other one is circuits/docs/source/examples/hello.py 

There is another one circuits/examples/hello.py. This one works, because it uses two events instead of one.

I think there is a simpler way to fix it. It needs only one event. Just move "raise SystemExit(0)" from the started handler to the hello handler like the one below


========= This one works. ====
from __future__ import print_function

from circuits import Component, Event


class hello(Event):
    """hello Event"""


class App(Component):

    def hello(self):
        print("Hello World!")
        raise SystemExit(0)

    def started(self, component):
        self.fire(hello())

App().run()
================ End of file =======

It is only a very trivial change. But since it is the first example shown in the home page, it might be a good idea to fix it.

Thanks!

James Mills

unread,
Jul 1, 2017, 11:47:34 PM7/1/17
to circuit...@googlegroups.com
Please send a PR and we'll merge it :D
--
You received this message because you are subscribed to the Google Groups "circuits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to circuits-users+unsubscribe@googlegroups.com.
To post to this group, send email to circuits-users@googlegroups.com.
Visit this group at https://groups.google.com/group/circuits-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages