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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:38:10+00:00 2026-06-05T20:38:10+00:00

I have a small GTK python application that imports a package (Twisted) that may

  • 0

I have a small GTK python application that imports a package (Twisted) that may not be loaded twice.

If I run my application in emacs with python-mode.el and press C-c C-c, the application gets executed in a python shell window.
If I now close the application, the python shell stays up and running. If I now press C-c C-c again, emacs “reuses” the old python process and thus I run into problems because I’m installing a Twisted reactor twice.

Is it possible to have python-mode.el open a new shell window each time I execute a buffer?

  • 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-05T20:38:12+00:00Added an answer on June 5, 2026 at 8:38 pm

    In python.el, a new inferior process is launched in a new buffer if the python-buffer variable is set to nil. Therefore, it’s possible to advise the python-send-buffer function to reset that variable to nil after every invocation, thereby forcing a new Python process to be executed for every subsequent python-send-buffer command. Something like the following should work:

    (defadvice
      python-send-buffer
      (after python-send-buffer-new-proc activate)
      (setq python-buffer nil))
    
    (ad-activate python-send-buffer)
    

    I know that your post was asking for help with python-mode.el, but I thought it might be helpful to mention this anyway, as I’d surprised if python-mode.el doesn’t use a similar mechanism. If I have time, I’ll try to look into it.

    Edit: the python-mode.el package uses the command py-shell to initiate a new inferior Python process. I found a mailing list posting in which a user provides an ad hoc function that appears to do what you need.

    By the way, it might be worth considering that trying to alter the default behavior of python-mode isn’t the best approach to this problem. I don’t know what your code does, and I’m not particularly familiar with Twisted, but it seems to me that experiencing major errors when evaluating your code a second time within the same session could be a sign of a more fundamental design problem. I fail to see how it could be a matter of multiple imports of the same module being the issue, as Python modules are only loaded once, with successive import statements having no effect (for that, an explicit reload or execfile() is required). If I’m completely off-base here, I apologize, but I felt this possibility might merit mention.

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

Sidebar

Related Questions

I have a small application that uses a DrawingArea to draw a simple map
I have small application that is uploading pictures to another website via webservice. My
I have small application: http://jsfiddle.net/Bwdf6/4/ But with click on delete, tags that created after
I have small question. When I started to programm my application, I grouped types
I have small web app that generate PDF files as a report. I'm trying
I have small HTTP server script that receives HTTP client requests and replies. I
I'm currently working on a small script that needs to use gtk.StatusIcon() . For
We have small class, that has a related class class Car has_one :engine, :dependent
I have a small project that uses libglade and use the following to load
I have small application using JSF 1.1. It is using NTLM for authentication. What

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.