Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8108269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:03:35+00:00 2026-06-06T01:03:35+00:00

Ok, this is maybe a difficult question. And I don’t want you to do

  • 0

Ok, this is maybe a difficult question. And I don’t want you to do all the hard work for me. I’m just tring to get some good advices and points where I should start.

I’m writing a couple of python programs and i’m having a bad time debugging those. So i’d like to create a simple debug function that records a couple of things.

This is how I’d use it:

# Defined in random_function_definitios.py
def some_random_function():
  a = 1 + 1
  debug(a)
  # More stuff

I’d like to display in debug this information:

  • The function that invoked it: some_random_function
  • The filename where that function is defined: random_function_definitios.py
  • The line number: 4
  • Some context: Global variables defined and local variables defined.

I’ve been taking a look at the inspect module and the frame builtin object. But i’m not completely sure if i’m in the right direction.

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:03:36+00:00Added an answer on June 6, 2026 at 1:03 am

    I wrote my own debugger.py with info / warning and debug messages.

    see: https://github.com/unixunion/toolbox/blob/master/python/debugger.py

    I also use a traceback to go through the stack like:

    except Exception, e:
        # capture the traceback data
        exc_type, exc_value, exc_traceback = sys.exc_info()
        warningMsg("-14 %s" % str(e))
        warningMsg("Exec Traceback")
        traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
        warningMsg("Exception")
        traceback.print_exception(exc_type, exc_value, exc_traceback, limit=2, file=sys.stdout)
        raise
    

    Gives results like:

    WARNING fabfile.py:76 glassfish_deploy()-14 cannot concatenate 'str' and 'float' objects
    WARNING fabfile.py:77 glassfish_deploy()Exec Traceback
    File "/home/marzubus/go-agent-scripts/fabfile.py", line 52, in glassfish_deploy    oiled =     gfOil(**kwargs)
    WARNING fabfile.py:79 glassfish_deploy()Exception
    Traceback (most recent call last):  File "/home/marzubus/go-agent-scripts/fabfile.py",    line 52, in glassfish_deploy
    oiled = gfOil(**kwargs)
    File "/home/marzubus/go-agent-scripts/oilon/gfdeployer.py", line 37, in __init__
    self.tmpDirectory = '/tmp/' + self.domainName + self.time
    TypeError: cannot concatenate 'str' and 'float' objects
    

    Kegan

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok so this maybe a simple/silly question but I don't know so here goes:
Alright, this maybe the simplest (or the stupidest) question, but I just got to
this maybe a noobish question so sorry, is it possible to run c programmes
This is maybe an oblique question: I'm writing an emulator in VB6 (silly me).
This question maybe a better fit on The Business of Software forum but despite
Maybe this is a poor question, but, I can't find a tutorial or even
This is a difficult question to search in Google since it has other meaning
I know this will be a difficult question, so I am not necessarily looking
Hopefully I can articulate my question well enough to get some clear and usable
I just have a quick question to see if this is possible with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.