How to debug Python Component ?

#1

How do you get them print values to the console or the log ?

How do you get a pdb prompt ?

0 Likes

#2

By component you mean something inheriting from one of the Autobahn classes?

Tobias wrote in two keyword arguments on the Factories that do this:

   ws_echo_endpoint = WebSocketServerFactory(debug=True, debugCodePaths=True)

···

On Tue, Mar 25, 2014 at 7:17 AM, Michel Desmoulin <desmoul...@gmail.com> wrote:

How do you get them print values to the console or the log ?

How do you get a pdb prompt ?
--
You received this message because you are subscribed to the Google Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#3

Thank you. What does that do ?

Do we have a similar facility for wsgi processes ?

···

On Tuesday, March 25, 2014 12:17:39 PM UTC+1, Michel Desmoulin wrote:

How do you get them print values to the console or the log ?

How do you get a pdb prompt ?

0 Likes

#4

"print" will do.

I have updated the Wiki page here:

https://github.com/crossbario/crossbar/wiki/Python-Application-Components

Please have a look at the log outputs there, e.g.

2014-03-25 16:55:03+0100 [Worker 3956] Ok, registered procedure for WAMP RPC (8930558121656713)

...

2014-03-25 16:55:13+0100 [Worker 3956] I am being called
2014-03-25 16:55:15+0100 [Worker 3956] I am being called
2014-03-25 16:55:17+0100 [Worker 3956] I am being called

These log lines come from the TimeService component being run.

···

Am 25.03.2014 12:17, schrieb Michel Desmoulin:

How do you get them print values to the console or the log ?

==

One note: the above Wiki pages describes 3 options to run your component. Only the first 2 work currently (due to a silly bug):

Running next to router, and run as separate worker process, but within same Crossbar node.

How do you get a pdb prompt ?

Huh. :wink: Dunno. I need to think about / investigate ..

Cheers,
/Tobias

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com
<mailto:autobahnws+...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#5

By component you mean something inheriting from one of the Autobahn
classes?

Tobias wrote in two keyword arguments on the Factories that do this:

   ws_echo_endpoint = WebSocketServerFactory(debug=True,
debugCodePaths=True)

This activates "low-level" log output (raw WebSocket messages being exchanged, and WAMP internal codepaths being taken).

This is useful if you debug AutobahnPython or Crossbar, or implement a WAMP library or to a limited extend when you use AutobahnPython classes directly for implementing your own server.

Nevertheless, we should have an option in Crossbar which activates this kind of low-level logging. It's not exposed currently .. we need to.

···

Am 25.03.2014 13:01, schrieb Nick Guenther:

On Tue, Mar 25, 2014 at 7:17 AM, Michel Desmoulin > <desmoul...@gmail.com> wrote:

How do you get them print values to the console or the log ?

How do you get a pdb prompt ?
--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#6

Michel,

Thank you. What does that do ?

Do we have a similar facility for wsgi processes ?

Crossbar:

You can use "print" in your WSGI app code .. that gets forwarded to the Node Controller and logged.

You can also activate the following options on "Web Transports":

"access_log": true,
"display_tracebacks": true

This should give you feedback when running a "WSGI Path Service" on a "Web Transport" ..

Hope this helps, let me know if you get stucked ..

Cheers,
/Tobias

···

Am 25.03.2014 16:36, schrieb Michel Desmoulin:

On Tuesday, March 25, 2014 12:17:39 PM UTC+1, Michel Desmoulin wrote:

    How do you get them print values to the console or the log ?

    How do you get a pdb prompt ?

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com
<mailto:autobahnws+...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#7

In the meantime, you can use IPython to fake (in a very natural and repeatable way) breakpoints and inspection. Whereever you want a breakpoint paste this line:
    import IPython; IPython.embed()

(IPython.embed's source shows that it hardcodes how many stackframes up it goes, so you cannot include this line as written inside of say, `def breakpoint():`)

-Nick Guenther
4A Stats/CS
University of Waterloo

···

On Tue, Mar 25, 2014 at 12:20 PM, Tobias Oberstein <tobias.o...@gmail.com> wrote:

Am 25.03.2014 12:17, schrieb Michel Desmoulin:

How do you get a pdb prompt ?

Huh. :wink: Dunno. I need to think about / investigate ..

0 Likes

#8

Thank you all.

···

On Tuesday, March 25, 2014 12:17:39 PM UTC+1, Michel Desmoulin wrote:

How do you get them print values to the console or the log ?

How do you get a pdb prompt ?

0 Likes