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 8221659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:00:24+00:00 2026-06-07T14:00:24+00:00

I have an app that creates Python code and runs it. During this process

  • 0

I have an app that creates Python code and runs it. During this process there are two method assignments that I’d like to clear as they create an error in the second run:

push = Writer.Push  
...  
def appPush(self):
    push(self)
    dumpRow(self)
...  
Writer.Push=appPush

It’s a legacy code I have to fix. If you run this more than once, Python announces that there’s a recursion.
I’ve been looking for a way to clear the environment but ‘os.system(‘CLS’)’ didn’t help. How can I clean those assignments?
Thanks.

Edit:
It IS legacy code. I’m not very familiar with it yet. My app creates Python code that contains general stuff (like the bit I’ve posted above) and a translation of the user’s workflow to Python. If the user creates a flow that ends up calling ‘appPush’, the application has to be restarted after 1 run.
I can add stuff after the above code. What I’m looking for is a way to clear the interpreter’s environment from those assignment. Is it possible?

  • 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-07T14:00:27+00:00Added an answer on June 7, 2026 at 2:00 pm

    OK, I see what your problem is.

    This code:

    push = Writer.Push  
    def appPush(self):
        push(self)
        dumpRow(self)
    Writer.Push=appPush
    

    Would cause infinite recursion if push were ever changed to appPush. What you basically want there is a decorator, so if you could change that to:

    def appPushCreator(func):
        def appPush(self):
            func(self)
            dumpRow(self)
        return appPush
    
    Writer.Push = appPushCreator(Writer.Push)
    

    This would keep the implied semantics of doing another dumpRow every time you used that bit of code.

    I don’t think you can fix your error by only adding code after the broken bit. You can’t ‘clear the environment’ and get your original Writer.Push back.

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

Sidebar

Related Questions

I have an app that creates a variable number of ScatterviewItems based on which
I have an app that creates a SQLite database ( with 24 records ),
I have an app that creates a database and do some stuff. I am
currently I have an app that creates all sorts of different requests to Facebook
I have a PHP app that creates a CSV file which is forced to
I have an ASP.NET Login App that creates a cookie called 'ASP_LOGIN77' and gives
I have an app that displays a splash screen. The splash screen activity creates
In my Silverlight app I have an event handler that dynamically creates a new
there I am writting a simple app in Python that will monitor the usage
Lets say I have this sample code: import wx app = wx.App(False) # Create

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.