2

So I'm here running my program on ssh secure shell and with Xming, but when I try to display my ".jpg" or ".bmp" image file on it, it returns an error: "Image file is not of type 1". What does this mean? The program runs fine on my computer, but just only when I am running through this server. The code is written in python. Thanks!

Here is the front of my code:

import wx
print wx.version()
import searchSeq
import sys
from wx.lib.pubsub import Publisher
from decimal import *
import math
import wx.lib.sheet as sheet

ID_ABOUT = 1
ID_EXIT = 2

class reWindow(wx.Frame):
    def __init__(self, parent, id):
        wx.Frame.__init__(self,parent,id, 'Restriction Enzyme Window',
                      size = (800, 500))

        #creat panel
        panel = wx.Panel(self)

        #insert picture
        pic = wx.Image("DNA.bmp", wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        self.button = wx.BitmapButton(panel, -1, pic, pos = (630,250))
        self.button.Bind(wx.EVT_BUTTON, self.runIt)

1 Answers1

1

The error message "Image file is not of type 1" means that the image you try to display is not a BMP file. 1 is the value of the wx.BITMAP_TYPE_BMP constant.

To confirm, just type :

import wx
print wx.BITMAP_TYPE_BMP

>>> 1

WX probably can't find the "DNA.bmp" image, you should use an absolute path to find/load this image.

EDIT :

When you told python to load "DNA.bmp", it will look into the current directory, and this, running on the server or through a ssh connection can be very different, using an absolute path will eliminate this problem.

Cédric Julien
  • 78,516
  • 15
  • 127
  • 132
  • that's odd though, since i have the image file at the same directory. why can't the program locate it? i have a .bmp and .jpg of the same picture just to make sure. – jack london Jun 05 '12 at 18:41