python / python/cpython

Permit import of .pyw under Linux

Open
#98,326 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-importlib type-feature
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Feature or enhancement

To allow under Linux the execution of a script written under Windows, importing modules, some of which have the .pyw file extension, it would be useful to allow linux to import the .pyw files.

Pitch

Sometimes you want to run under linux a script written under windows which import modules, some having the file extension ".pyw". Today, we are forced to rename all pyw files to py to switch from Windows to Linux. But this is not always desirable, if you use a third party script or if you work cooperatively on a project, with developers under Windows and Linux. Moreover, there is no solution to recognize the py files to be renamed to pyw when you want to switch back to Windows.

Previous discussion

Importing .pyw files has been discussed here :
https://mail.python.org/pipermail/patches/2001-August/005411.html
And it is mentioned that "with slight modification, it could
permit the extension on any platform if desired"

Another discussion on the subject :
https://stackoverflow.com/questions/21386094/importing-pyw-files-as-modules-under-linux

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files, tests, or entry points are named. Review Python's import behavior for .pyw files under Linux and the two linked discussions first; define the cross-platform behavior and add tests demonstrating successful imports without requiring file renaming.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.