#[SOLVED] Help for debugging - Refactoring

1 messages · Page 1 of 1 (latest)

mystic hemlock
#

Hi all

I'm refactoring some part of my Dagger Python SDK code and I get some errors like in my image below. I'll be able to retrieve quite easily that specific error but ... in a generic approach, **how do you debug your Dagger code? **

Below, i'm running dagger call with these flags -vvvv --progress=plain --interactive and the error 'str' object has no attribute 'name' didn't give me a stack I can use to know in which file I need to continue my refactoring.

Is there anything I can do to get more debugging info (and stack trace)?

Many thanks

plucky finch
mystic hemlock
#

Hi Marco, no sorry, everything is running on my laptop.
This is a generic question: I've plenty of classes and files and more than 70 functions.
I'm doing a few refactoring and thus, yeah, it's normal to have some errors like that.
The generic question is how can I debug better and be more efficient searching for the location of the error.

plucky finch
plucky finch
mystic hemlock
#

Is this needed? I mean can I debug on my disk like I do for all other coding works

plucky finch
#

ok, I thought you also were looking some help about the error itself

mystic hemlock
plucky finch
#

I guess it's hard to give a single advise on troubleshooting since there are several aspects of the Dagger platform that can be approached differently. In your particular case, when it comes to function definitions, it's generally a good practice to create examples and tests of your functions (https://github.com/marcosnils/daggerverse/tree/main/k3s/examples) so you can quickly validate if any of your APIs changed while the behavior remaining the same 🙏

GitHub

Personal collection of Dagger modules. Contribute to marcosnils/daggerverse development by creating an account on GitHub.

mystic hemlock
#

Like always I really appreciate your help and how fast you're to provide support.

In this I'm not sure to understand (I've looked at your repo).

When coding directly in Python (not Dagger; pure Python), if I try to remove an inexisting file f.i., I'll get an exception with a stack trace and it's piece of cake to know the cause and where to patch.

Let's take a fictive example:

@function
async def debug(self) -> str:
    """DEBUG - Display some debug info."""
    return (
        f"Version     : {Constants.version}\n"
        f"Project_type: {self.project_type}\n"
        f"Author      : {self.author}\n"
    )

And I got an error telling me author didn't exists.

The error is Error: input: src.debug 'Src' object has no attribute 'author' .

My generic question is: how can I be more efficient to easily retrieve where, in my codebase (stack trace), I need to intervene to patch that error? (would be great if I can see it's in my main.py script, function debugon line xxx and the error is located at line yyy)

humble solstice
mystic hemlock
#

Nice ! Thanks a lot !!!

#

[SOLVED] Help for debugging - Refactoring

mystic hemlock
#

Just to confirm: it's works great. Without it, I just get an error message but with it (and progress=plain), now I can get a lot more info and can better understand from where my "fatal error" comes from. Thanks a lot @humble solstice

Instead of just getting this error message init() should return None, not 'coroutine', now, with your tip; I get this (see image), much better (y)

mystic hemlock
mystic hemlock
humble solstice
#

Would it have been enough if above the error you had the line from your code that originated it but not the entire stack trace? Or was more of the trace useful?