very odd, random window dumps

Discussion in 'Python' started by Peter Kleiweg, Sep 9, 2004.

  1. This is weird...

    Running small Python scripts, now and again a window dump is
    created, and saved as the module name without the extension.
    This happens on Linux. The dumped file is a PostScript file with
    the image of one Window that was active at the moment
    (completely unrelated to the Python application), and has a
    header comment that says it was created by ImageMagick. Magic,
    indeed. The file has the somewhat unusual access bits
    -rwxr--r--, but normal user and group.


    --
    Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia)
    info: http://www.let.rug.nl/~kleiweg/ls.html
    Peter Kleiweg, Sep 9, 2004
    #1
    1. Advertising

  2. Peter Kleiweg schreef:

    >
    > This is weird...
    >
    > Running small Python scripts, now and again a window dump is
    > created, and saved as the module name without the extension.
    > This happens on Linux. The dumped file is a PostScript file with
    > the image of one Window that was active at the moment
    > (completely unrelated to the Python application), and has a
    > header comment that says it was created by ImageMagick. Magic,
    > indeed. The file has the somewhat unusual access bits
    > -rwxr--r--, but normal user and group.


    I think I solved it. A script that starts with this:

    import somemodule

    Call it with sh instead of python, and the shell calls the
    program 'import', which happens to be an existing program, part
    of ImageMagick, and that program writes a screen dump to its
    argument, in this case to file 'somemodule'.

    My scripts start with this line:

    #!/usr/bin/env python

    So they should be run with python. However, I discovered that if
    I make a small typo, and use this:

    !/usr/bin/env python

    Then the shell doesn't understand the first line, prints an error, and
    continues processing the rest of the file as if it were a common shell
    script.

    That must be what happened.

    --
    Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia)
    info: http://www.let.rug.nl/~kleiweg/ls.html
    Peter Kleiweg, Sep 9, 2004
    #2
    1. Advertising

  3. Peter Kleiweg wrote:

    > Running small Python scripts, now and again a window dump is
    > created, and saved as the module name without the extension.
    > This happens on Linux. The dumped file is a PostScript file with
    > the image of one Window that was active at the moment
    > (completely unrelated to the Python application), and has a
    > header comment that says it was created by ImageMagick. Magic,
    > indeed. The file has the somewhat unusual access bits
    > -rwxr--r--, but normal user and group.


    This is probably the result of accidentally typing "import somemodule" on
    the Linux command line before invoking the python interpreter. "import" is
    an ImageMagick command that takes a window capture.

    i.e.:

    $ import myprog
    <hangs>
    <click the window>
    $ python
    >>> import myprog

    ....

    Jeffrey
    Jeffrey Froman, Sep 9, 2004
    #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. Victor Kryukov
    Replies:
    8
    Views:
    470
    Gabriel Genellina
    May 17, 2007
  2. globalrev
    Replies:
    4
    Views:
    739
    Gabriel Genellina
    Apr 20, 2008
  3. Sunjay Varma
    Replies:
    4
    Views:
    329
    John Roth
    Mar 10, 2011
  4. Danie Roux
    Replies:
    3
    Views:
    96
    Charles Mills
    Feb 21, 2006
  5. VK
    Replies:
    15
    Views:
    1,110
    Dr J R Stockton
    May 2, 2010
Loading...

Share This Page