How to debug server side code

69 views
Skip to first unread message

Fabio Lenzarini

unread,
Oct 10, 2024, 11:59:12 AM10/10/24
to Jam.py Users Mailing List
Hello everyone,
unfortunately I never have a lot of time to devote to Jam.Py (I work very hard on D365 F&O).. but some timeI experiment and carry on some SW that helps me in my work.
When we have to write code that works a lot on data, we always have the dilemma:
do I write it client-side with JS or server-side in Python?
well, if we have to manipulate a lot of data, the server side is much closer to the data and definitely faster..
But it is also true that JS code is easier to debug....

Today I tried for the umpteenth time to debug the server code.

And I succeeded!
With Visual studio code I open the file “server.py” from the project folder d the file “wsgi.py” in the Jam.py folder.
I put a breackpoint at line 747 “def server_func...” where there is “result = func(obj, *params). then I debug ‘server.py’.

On the browser I open the application and run the function that executes the server-side code to debug... et voila!
I can see on Visual studio code my server funcion and I debug every line of code!

Another step is done!

ciao
Fabio


Dean D. Babic

unread,
Oct 10, 2024, 9:04:00 PM10/10/24
to Jam.py Users Mailing List
Nice!
Thanks for sharing

Dean D. Babic

unread,
Oct 15, 2024, 11:07:58 PM10/15/24
to Jam.py Users Mailing List
Hi Fabio, 

just tried to do this but no luck.
Could you record a video?

Cheers

Fabio Lenzarini

unread,
Oct 16, 2024, 4:30:58 AM10/16/24
to Jam.py Users Mailing List
Hi Drazen, it was my intention to do that...
By the way I realized that there is a problem in updating the displayed sources, they are corrected only if there is an error..

ciao
Fabio

Fabio Lenzarini

unread,
Nov 6, 2024, 5:04:00 AM11/6/24
to Jam.py Users Mailing List
Hi, the video are more than 200MB and I can't load it..

Drazen Babic

unread,
Nov 6, 2024, 5:05:59 AM11/6/24
to Fabio Lenzarini, Jam.py Users Mailing List
Google drive can handle this imo

Cheers

--
You received this message because you are subscribed to a topic in the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jam-py/k7H4bHLpKL8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jam-py+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jam-py/2c15a98f-6ca8-4e91-a4a9-e3fef095cfa1n%40googlegroups.com.

Fabio Lenzarini

unread,
Nov 6, 2024, 7:09:26 AM11/6/24
to Jam.py Users Mailing List
debug.pdf

Dean D. Babic

unread,
Oct 2, 2025, 4:04:50 AM (3 days ago) Oct 2
to Jam.py Users Mailing List
Hi, 

if someone is interested, to debug server side, including Server Module content changes, add this in bold to wsgi.py:

    def server_func(self, obj, func_name, params):
        result = None
        error = ''
        func = getattr(obj, func_name)
        if func:
            result = func(obj, *params)
            if consts.SHOW_SELECT_SQL:
                print('-- Server code start --')
                print(func_name, params)
                print('-- Server code end --')
        else:
            raise Exception('item: %s no server function with name %s' % (obj.item_name, func_name))
        return result, error

If Show Select SQL is ON on Parameters, this will also show server side. Than, we can use similar format
as in items.py class SQLFormatter.

Cheers

D.
Reply all
Reply to author
Forward
0 new messages