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

  • Home
  • SEARCH
  • 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 7493189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:48:17+00:00 2026-05-29T16:48:17+00:00

I have a python script that I want to debug with python-mode . I

  • 0

I have a python script that I want to debug with python-mode. I read in this thread that I can debug my python script with M-x pdb, however I get the following error:

Searching for program: no such file or directory, pdb

I can provide python -m pdb my_source_file.py in the prompt in the minibuffer, but it would be nice if Emacs could infer this command directly from the file on which I run M-x pdb

Update:

Running on:

  • Red Hat Enterprise Linux Server release 5.1 (Tikanga)
  • Emacs 23.3.1

Differences between paths

I get different paths when I run M-: exec-path and when I run M-: (getenv "PATH") (the one returned by M-: (getenv "PATH") is longer).

With this:

  • Where is pdb located? How can I add it to the Emacs path?
  • Is there a way to ask Emacs to also look into the paths held by the environment variable PATH?
  • 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-05-29T16:48:26+00:00Added an answer on May 29, 2026 at 4:48 pm

    Further to my comment earlier, and your subsequent update to the question:

    First figure out a value for $PATH that works in your terminal. Use which pdb to find where the pdb executable is located.

    Then, set the $PATH environment variable explicitly in Emacs, and sync it to exec-path as follows:

    (setenv "PATH" "/usr/local/bin:/usr/bin:/bin:/some/other/dir")
    (setq exec-path (split-string (getenv "PATH") path-separator))
    

    It’s possible you would need to also explicitly set PYTHONPATH or similar environment variables; you can do that using lines like the “setenv” line above, or just use the exec-path-from-shell elisp package.

    Update

    Okay, so it turns out Emacs’ pdb command isn’t provided by python-mode, and it expects to find an executable called “pdb”. The easy way to fix this, then is to create a shell wrapper called “pdb”, in a directory on your $PATH:

    #!/bin/sh
    exec python -m pdb "$@"
    

    (I found a note here suggesting this technique.)

    The equivalent under Windows would be a file called pdb.bat, containing:

    python -u -m pdb %1
    

    (The -u prevents Python from buffering its output.)

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

Sidebar

Related Questions

I have a simple Python script that I want to stop executing if a
I have a Iron Python script that I want to run and then have
I have a python script that invokes the following command: # make After make,
I have created a Python script that I want to run daily via a
I have a python script that i want to run from the command line
I have a Python script that I want to use as a controller to
I made a .pyw python script that I want to have running in the
I have a pretty simple python script that sends emails, something like this: import
I have a python script that analyzes a set of error messages and checks
I have a Python script that needs to execute an external program, but for

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.