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 — Add ability to set python module file string instead of it always being None · Issue #2043 · pythonnet/pythonnet

Add ability to set python module file string instead of it always being None #2043

New issue
Copy link
New issue
Copy link
Open
Open
Add ability to set python module file string instead of it always being None#2043
Copy link

Description

@bmello4688
bmello4688
opened on Dec 8, 2022
Issue body actions

Environment

  • Pythonnet version: Latest
  • Python version: 3.7+
  • Operating System: All
  • .NET Runtime: All

Details

  • Describe what you were trying to get done.

    When creating a python module from a string (PyModule FromString) the file parameter is always set to None. If I want to create a virtual package structure in memory I need to be able to set file to a specified file structure.

Activity

  1. filmor commented on Dec 8, 2022

    @filmor
    filmor
    on Dec 8, 2022
    Member
    More actions

    You have to set it yourself, that's how it works in the C-API as well: https://docs.python.org/3/c-api/module.html#c.PyModule_NewObject

  2. filmor
    closed this as not plannedon Dec 8, 2022
  3. filmor
    reopened this on Dec 8, 2022
  4. filmor commented on Dec 8, 2022

    @filmor
    filmor
    on Dec 8, 2022
    Member
    More actions

    Sorry, I just saw your PR (#2044), is this not the same as just setting __file__ explicitly on the PyModule object?

  5. bmello4688 commented on Dec 8, 2022

    @bmello4688
    bmello4688
    on Dec 8, 2022 via email
    ContributorAuthor
    More actions
    Yes, it is the same thing. It just seems a bit clunky that it is initially set to none then I have to overwrite it with the correct file structure.
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      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.