Skip to content

ImportError: No module named scrap on Windows 7 x64 (105) #120

@GalacticEmperor1

Description

@GalacticEmperor1

Issue №105 opened by illume at 2012-01-19 09:24:47

Originally reported by: Mahmoud Hossam (Bitbucket: mahmoudhossam, GitHub: mahmoudhossam)


I have installed Python 3.2 (32-bit) and pygame 1.9.2 on windows 7 using the installers on the website, but I get an ImportError when trying to access pygame's help inside the interpreter

# !python

Python 3.2.2 (default, Sep  4 2011, 09:51:08) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pygame
>>> pygame.init()
(6, 0)
>>> help(pygame)

Warning (from warnings module):
  File "C:\Python32\lib\inspect.py", line 103
    return (hasattr(object, "__get__")
RuntimeWarning: use scrap: No module named scrap
(ImportError: No module named scrap)
Traceback (most recent call last):
  File "<pyshell# 2>", line 1, in <module>
    help(pygame)
  File "C:\Python32\lib\site.py", line 457, in __call__
    return pydoc.help(*args, **kwds)
  File "C:\Python32\lib\pydoc.py", line 1754, in __call__
    self.help(request)
  File "C:\Python32\lib\pydoc.py", line 1804, in help
    else: doc(request, 'Help on %s:', output=self._output)
  File "C:\Python32\lib\pydoc.py", line 1540, in doc
    pager(render_doc(thing, title, forceload))
  File "C:\Python32\lib\pydoc.py", line 1533, in render_doc
    return title % desc + '\n\n' + renderer.document(object, name)
  File "C:\Python32\lib\pydoc.py", line 338, in document
    if inspect.ismodule(object): return self.docmodule(*args)
  File "C:\Python32\lib\pydoc.py", line 1064, in docmodule
    for key, value in inspect.getmembers(object, inspect.isroutine):
  File "C:\Python32\lib\inspect.py", line 263, in getmembers
    if not predicate or predicate(value):
  File "C:\Python32\lib\inspect.py", line 248, in isroutine
    or ismethoddescriptor(object))
  File "C:\Python32\lib\inspect.py", line 103, in ismethoddescriptor
    return (hasattr(object, "__get__")
  File "C:\Python32\lib\site-packages\pygame\__init__.py", line 70, in __getattr__
    raise NotImplementedError(MissingPygameModule)
NotImplementedError: scrap module not available
(ImportError: No module named scrap)


Comments

# # illume commented at 2012-02-29 19:32:14

Original comment by Anonymous:


+1, I also have this error and was wondering if it was a bug in the distribution or my installation


# # illume commented at 2012-03-01 04:12:21

Original comment by cgohlke (Bitbucket: cgohlke, GitHub: cgohlke):


The scrap extension is not yet ported to Python 3 for Windows, and is excluded in setup.py. See https://bitbucket.org/pygame/pygame/src/0921cc0fbca7/setup.py# cl-159. The attached patch should fix this.


# # illume commented at 2012-03-20 03:57:02

Original comment by Lenard Lindstrom (Bitbucket: llindstrom, GitHub: llindstrom):


I have enabled scrap builds for Python 3.x on Windows in changeset d811a6f742d8. It passes the unit tests. Warning, though, scrap is buggy with binary data.


# # illume commented at 2012-03-21 20:44:21

Original comment by Lenard Lindstrom (Bitbucket: llindstrom, GitHub: llindstrom):


Fix bytes decoding problem in scrap_clipboard.py example (refs # 105)

On Windows, the '\ufffd' unicode replacement character is not recognized.
So, for the 'replace' decoding errors option, a UnicodeEncodingError
exception is raised for non-ascii bytes. The 'ignore' errors option,
though less informative, raises no exceptions.


# # illume commented at 2012-03-21 20:48:06

Original comment by Lenard Lindstrom (Bitbucket: llindstrom, GitHub: llindstrom):


My concern regarding binary data in the clipboard was unfounded. It was a problem with pygame.examples.scrap_clipboard, not pygame.scrap. So please give scrap another try on Windows. If there are no more concerns I will close this issue.


# # illume commented at 2012-04-10 10:39:02

Original comment by Anonymous:


I have this problem too ('scrap not available'). Does anybody know help???????


# # MyreMylar commented at 2019-11-12 13:32:35

This crash doesn't happen in python 3 builds on windows anymore.

Tested original reproduction on 3.4 (pygame 1.9.6) & 3.7 (pygame 2.0-dev6) on windows.

Though even Python 3.4 is EOL now.

Recommend close.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions