GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Example in section 5.3 "Pure Embedding" doesn't work. · Issue #42771 · python/cpython

Example in section 5.3 "Pure Embedding" doesn't work. #42771

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
Example in section 5.3 "Pure Embedding" doesn't work.#42771
Copy link
Labels
3.10 (EOL)end of lifeend of lifedocsDocumentation in the Doc dirDocumentation in the Doc dirextension-modulesC modules in the Modules dirC modules in the Modules dirtopic-C-APItype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

wrstuden
mannequin
opened on Jan 6, 2006
Issue body actions
BPO 1398781
Nosy @birkenfeld, @birkenfeld, @vstinner

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2006-01-06.19:23:52.000>
labels = ['extension-modules', 'type-bug', '3.10', 'docs']
title = 'Example in section 5.3 "Pure Embedding" doesn\'t work.'
updated_at = <Date 2020-12-29.04:39:25.362>
user = 'https://bugs.python.org/wrstuden'

bugs.python.org fields:

activity = <Date 2020-12-29.04:39:25.362>
actor = 'orsenthil'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation', 'Extension Modules']
creation = <Date 2006-01-06.19:23:52.000>
creator = 'wrstuden'
dependencies = []
files = []
hgrepos = ['261']
issue_num = 1398781
keywords = []
message_count = 7.0
messages = ['60866', '60867', '60868', '182510', '212842', '221302', '348609']
nosy_count = 7.0
nosy_names = ['georg.brandl', 'georg.brandl', 'vstinner', 'wrstuden', 'docs@python', 'Ramchandra Apte', 'fkochem', 'jhao']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'test needed'
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue1398781'
versions = ['Python 3.10']

Activity

Next
  1. wrstuden commented on Jan 6, 2006

    @wrstuden
    wrstudenmannequin
    on Jan 6, 2006
    MannequinAuthor
    More actions

    I want to use Python to script an existing application.
    So I was trying the code on
    http://docs.python.org/ext/pure-embedding.html and
    found it didn't work.

    I am using pkgsrc on NetBSD.

    I have run into two issues. First,
    PyDict_GetAttrString() does not exist. I have found
    this to be true for both Python 2.2 and 2.4, the two
    versions I currently have installed.

    I made the simple change to use
    PyObject_GetAttrString(), which looks right.

    Second, python can't find the module. I named the file
    multiply.py, and it wouldn't load.

    It turns out that I had to set PYTHONPATH in my
    envirnment to make it work. Setting it to '' (empty
    string) worked.

    The odd thing about the path issue is that if I ran the
    python interpreter, it was able to find the module w/o
    my changing the environment.

  2. wrstuden
    added
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    on Jan 6, 2006
  3. birkenfeld commented on Jan 6, 2006

    @birkenfeld
    birkenfeld
    on Jan 6, 2006
    Member
    More actions

    Logged In: YES
    user_id=1188172

    The PyDict_GetAttrString issue is corrected in the current
    devel docs.

    No clue about the other.

  4. wrstuden commented on Jan 6, 2006

    @wrstuden
    wrstudenmannequin
    on Jan 6, 2006
    MannequinAuthor
    More actions

    Logged In: YES
    user_id=148388

    Great to hear about PyDict_GetAttrString(). I assume that
    PyObject_GetAttrString() was the correct change?

    It turns out the second issue deals with path processing in
    the embedded code being somehow different from processing in
    the interpreter. I think the interpreter sets something up
    that isn't present for the embedded example. I will really
    appreciate it if we could figure out what's different and
    add it to the docs. The pictured behavior for "call" is
    exactly what I want, but not what I get.

    To be more specific, I had my code print Py_GetPath(), and I
    compared that with sys.path from the interpreter.

    C code looking for foo.py (which is in '.'):

    ./obj.i386/test foo
    Path is
    '/usr/pkg/lib/python24.zip:/usr/pkg/lib/python2.4/:/usr/pkg/lib/python2.4/plat-netbsd3:/usr/pkg/lib/python2.4/lib-tk:/usr/pkg/lib/python2.4/lib-dynload'
    ImportError: No module named foo
    utest: loading module foo: No such file or directory

    In the python interpreter:

    > python2.4
    Python 2.4.1 (#1, Dec 28 2005, 15:58:29) 
    [GCC 3.3.3 (Wasabi NetBSD nb3 20040520)] on netbsd3
    Type "help", "copyright", "credits" or "license" for more
    information.
    >>> import sys
    >>> print sys.path
    ['', '/usr/pkg/lib/python24.zip', '/usr/pkg/lib/python2.4',
    '/usr/pkg/lib/python2.4/plat-netbsd3',
    '/usr/pkg/lib/python2.4/lib-tk',
    '/usr/pkg/lib/python2.4/lib-dynload',
    '/usr/pkg/lib/python2.4/site-packages']

    The key difference is the '' at the front of the path in the
    interpreter.

    Any thoughts? Is there a different list or FAQ I should look at?

  5. devdanzin
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Mar 20, 2009
  6. devdanzin
    assigned
    birkenfeld
    on Mar 20, 2009
  7. devdanzin
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Mar 20, 2009
  8. devdanzin
    assigned
    birkenfeld
    on Mar 20, 2009
  9. devdanzin
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Mar 20, 2009
  10. devdanzin
    added
    easy
    on Apr 22, 2009
  11. BreamoreBoy
    assigned
    docspython
    and unassigned
    birkenfeld
    on Aug 26, 2010
  12. 4 remaining items

  13. jhao commented on Jun 22, 2014

    @jhao
    jhaomannequin
    on Jun 22, 2014
    Mannequin
    More actions

    I have updated the example in the doc. This default behavior is introduced because of security reason as detailed in http://bugs.python.org/issue5753

  14. vstinner commented on Jul 29, 2019

    @vstinner
    vstinner
    on Jul 29, 2019
    Member
    More actions

    This issue is 13 years old, inactive for 5 years, has a patch: it's far from being "newcomer friendly", I remove the "Easy" label.

  15. orsenthil
    added
    3.10 (EOL)end of lifeend of life
    and removed
    easy
    on Dec 29, 2020
  16. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  17. slateny commented on Jun 13, 2022

    @slateny
    slateny
    on Jun 13, 2022
    Contributor
    More actions

    The earliest link to the original issue I could find is this, which has a section matching the title, and the example in that does seem to correspond to the modern link here.

  18. encukou
    marked C-API Pure Embedding enhancement #68840 as a duplicate of this issue on Jun 18, 2025
  19. ashm-dev commented on Nov 13, 2025

    @ashm-dev
    ashm-dev
    on Nov 13, 2025
    Contributor
    More actions

    Ping. Is this issue still relevant?

  20. vstinner
    added
    topic-C-API
    on Nov 13, 2025
  21. github-project-automation
    added this to docs issueson Nov 13, 2025
  22. github-project-automation
    moved this to Todo in docs issueson Nov 13, 2025
  23. vstinner commented on Nov 13, 2025

    @vstinner
    vstinner
    on Nov 13, 2025
    Member
    More actions

    Let's close this old issue. The context is now outdated.

    The doc now lives at: https://docs.python.org/dev/extending/embedding.html.

    If someone is still impacted by the issue, please open a new issue.

  24. vstinner
    closed this as not plannedon Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10 (EOL)end of lifeend of lifedocsDocumentation in the Doc dirDocumentation in the Doc dirextension-modulesC modules in the Modules dirC modules in the Modules dirtopic-C-APItype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • docs issues
      Status
      Todo
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.