Skip to content

Import of _pyio module failed on cygwin #76468

Closed

Description

@matusvalo
mannequin
BPO 32287
Nosy @tiran, @embray, @zware, @ma8ma, @matusvalo
Superseder
  • bpo-28459: _pyio module broken on Cygwin / setmode not usable
  • 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 = <Date 2017-12-19.11:54:40.502>
    created_at = <Date 2017-12-12.11:14:02.236>
    labels = ['3.7', 'type-bug', 'library', 'expert-IO']
    title = 'Import of _pyio module failed on cygwin'
    updated_at = <Date 2018-03-23.20:05:53.273>
    user = 'https://github.com/matusvalo'

    bugs.python.org fields:

    activity = <Date 2018-03-23.20:05:53.273>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-12-19.11:54:40.502>
    closer = 'erik.bray'
    components = ['Library (Lib)', 'IO']
    creation = <Date 2017-12-12.11:14:02.236>
    creator = 'Mat\xc3\xba\xc5\xa1 Valo'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32287
    keywords = []
    message_count = 9.0
    messages = ['308115', '308116', '308117', '308135', '308136', '308138', '308139', '308172', '308629']
    nosy_count = 5.0
    nosy_names = ['christian.heimes', 'erik.bray', 'zach.ware', 'masamoto', 'Mat\xc3\xba\xc5\xa1 Valo']
    pr_nums = []
    priority = 'low'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '28459'
    type = 'behavior'
    url = 'https://bugs.python.org/issue32287'
    versions = ['Python 3.7']

    Activity

    1. matusvalo commented on Dec 12, 2017

      matusvalomannequin
      MannequinAuthor
      When trying to impor _pyio from python3 in Cygwin, import fails with exception:
      $ python3
      Python 3.6.3 (default, Oct 31 2017, 19:00:36)
      [GCC 6.4.0] on cygwin
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import _pyio
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/usr/lib/python3.6/_pyio.py", line 17, in <module>
          from msvcrt import setmode as _setmode
      ModuleNotFoundError: No module named 'msvcrt'

      This issue is breaking cherrypy server (cheroot component):
      https://github.com/cherrypy/cheroot/blob/86c6b246ec7cb704c6f96123556db1a083301634/cheroot/makefile.py#L5

    2. added
      type-crash
      stdlib
      on Dec 12, 2017
    3. matusvalo commented on Dec 12, 2017

      matusvalomannequin
      MannequinAuthor
      Previous import is working in python 2.7:
      $ python
      Python 2.7.14 (default, Oct 31 2017, 21:12:13)
      [GCC 6.4.0] on cygwin
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import _pyio
      >>>
    4. tiran commented on Dec 12, 2017

      @tiran
      Member

      The msvcrt module is part of the standard library on Windows. Your cygwin installation may be incomplete.

      By the way, why are you importing a private module? _pyio isn't a public API and shouldn't be used.

    5. zware commented on Dec 12, 2017

      @zware
      Member

      Presumably this issue does prevent us from testing _pyio on Cygwin, which is not ideal. The outside usage of _pyio is definitely not supported, as Christian said, but this may be worth fixing anyway.

    6. added
      3.7 (EOL)
      type-bug
      and removed
      type-crash
      on Dec 12, 2017
    7. matusvalo commented on Dec 12, 2017

      matusvalomannequin
      MannequinAuthor

      I am using not using _pyio module directly but I am using cherrypy server which is using this module (more precisely its component cheroot):
      https://github.com/cherrypy/cheroot/blob/86c6b246ec7cb704c6f96123556db1a083301634/cheroot/makefile.py#L5

      Regarding installation of cygwin environment, I can check it in other machine.

    8. tiran commented on Dec 12, 2017

      @tiran
      Member

      Could you please file a bug with cherrypy and get it fixed?

      Cygwin not yet officially supported and stable. Erik is working hard on stable support for 3.7.

    9. zware commented on Dec 12, 2017

      @zware
      Member

      Right, so you should raise an issue with cherrypy :). You're more likely to get a fix from them quickly, and their usage of _pyio is not correct anyway.

      Also, note that Cygwin is not (anymore/yet) a fully-supported platform. We're working towards that status, but aren't there yet.

    10. ma8ma commented on Dec 12, 2017

      ma8mamannequin
      Mannequin

      This issue seems to duplicate bpo-28459.

      bpo-28459 has a patch (implement _setmode() by ctypes on _pyio). I'm not sure _setmode() will be used in other places in the future, but the patch just works at the moment.
      In addition, I have an idea which implements C extension (imitation msvcrt or just cygwin).

    11. embray commented on Dec 19, 2017

      @embray
      Contributor

      Indeed, this is a duplicate of bpo-28459. I'll also update the existing patch to a pull request.

    12. transferred this issue fromon Apr 10, 2022
    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.7 (EOL)stdlibtopic-IOtype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions