import ImageGrab fails on Ubuntu 10.4

Discussion in 'Python' started by News123, Oct 31, 2010.

  1. News123

    News123 Guest

    Hi,

    It's the first time I wanted to use ImageGrab.

    importing ImageGrab fails as seen below:


    $ python -c "import ImageGrab"
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/usr/lib/python2.6/dist-packages/PIL/ImageGrab.py", line 34, in
    <module>
    import _grabscreen
    ImportError: No module named _grabscreen
    $


    Is this an issue for all Ubuntu 10.4 releases or is this only failing on
    my host?


    Thanks in advance
     
    News123, Oct 31, 2010
    #1
    1. Advertising

  2. News123

    News123 Guest

    On 10/31/2010 05:04 PM, News123 wrote:

    > importing ImageGrab un Ubuntu 10.4 fails as seen below:
    >
    > import _grabscreen
    > ImportError: No module named _grabscreen
    >



    Well I found a partial answer on
    http://www.pythonware.com/library/pil/handbook/imagegrab.htm

    > The ImageGrab module can be used to copy the contents of the screen or the clipboard to a PIL image memory.
    >
    > The current version works on Windows only.



    I just wonder why there is no cleaerer message like

    "platform not supported"


    As a workaround I use now:

    cmd = "import -window root %s" % fname
    os.system(cmd)
    img = Image.open(fname)

    using the 'import' command of the ImageMagick tool kit

    Is there any other way to make screen shots in Linux, ideally without
    creating an intermediate file
     
    News123, Oct 31, 2010
    #2
    1. Advertising

  3. Re: import ImageGrab fails on Ubuntu 10.04

    In message <4ccd954f$0$12350$>, News123 wrote:

    > Is there any other way to make screen shots in Linux, ideally without
    > creating an intermediate file


    The ImageMagick “import†command lets you grab the contents of any window
    (including the root window) from your X server
    <http://www.imagemagick.org/script/import.php>. It wants an output filename,
    but of course that can be /dev/stdout, e.g.

    import -window root /dev/stdout | display
     
    Lawrence D'Oliveiro, Nov 1, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Erik Max Francis

    PIL ImageGrab.grab memory leak

    Erik Max Francis, Jul 21, 2004, in forum: Python
    Replies:
    0
    Views:
    793
    Erik Max Francis
    Jul 21, 2004
  2. Askari
    Replies:
    1
    Views:
    4,345
    Fredrik Lundh
    Sep 6, 2004
  3. gslm

    ImageGrab

    gslm, Apr 3, 2007, in forum: Python
    Replies:
    0
    Views:
    442
  4. gslm

    ImageGrab

    gslm, Apr 4, 2007, in forum: Python
    Replies:
    0
    Views:
    521
  5. SPE - Stani's Python Editor
    Replies:
    1
    Views:
    474
    SPE - Stani's Python Editor
    Apr 29, 2008
Loading...

Share This Page