Python 2.6 IOError: cannot find font file

Hardware, software, mobiteli, programiranje, internet...

Moderator: Bobi

Post Reply
User avatar
haro2x
Posts: 202
Joined: 08/08/2009 02:44
Location: Goa

Python 2.6 IOError: cannot find font file

Post by haro2x » 24/02/2011 13:42

Pomagajte
Napiso sam mali programcic da mogu gledati u realtime kroz svoj webcam. Sve radi kako treba dok ne kompajlujem kod u exe. Onda dobijem ovaj error

Code: Select all

Traceback (most recent call last):
  File "cam.py", line 25, in <module>
  File "cam.py", line 13, in __init__
  File "VideoCapture.pyc", line 50, in __init__
  File "PIL\ImageFont.pyc", line 247, in load_path
IOError: cannot find font file


Guglo sam i naso na py2exe web stranici rjesenje ko trebam kopirati fajlove helvetica-10.pil, helvB08.pil, helvetica-10.png and helvB08.png u "dist" direktorij. To sam i uradio, ali opet istu gresku javlja. :x :x

Evo i source

Code: Select all

import pygame
from pygame.locals import *
from VideoCapture import Device
import PIL

class webcam:
    def __init__(self):
  self.window = pygame.display.set_mode((500, 500))
  pygame.display.set_caption("Web kamera")
  self.screen = pygame.display.get_surface()
  self.cam = Device()
  self.record()

    def record(self):
  img = self.cam.getImage()
  pygame.time.delay(int(1000 * 1.0/20))
  self.frejm = pygame.image.frombuffer(img.tostring(),img.size,img.mode)
  self.screen.blit(self.frejm, (0, 0))
  pygame.display.flip()
  self.record()

app = webcam()

Unaprijed zahvalan :D :D


Bušman
Posts: 2123
Joined: 08/04/2008 08:48

Re: Python 2.6 IOError: cannot find font file

Post by Bušman » 24/02/2011 16:49

Druze, koristi OpenCV. Jedino tako ce ti biti realtime 100% :D On u linuxu koristi direktno v4l2 tako da nece biti problema. U sustini se svede na ovo:

Code: Select all

import cv
cv.NamedWindow("webcam", cv.CV_WINDOW_AUTOSIZE)
capture = cv.CaptureFromCAM(0)
def prikazi():
    frame = cv.QueryFrame(capture)
    cv.ShowImage("webcam", frame)
while 1:
    prikazi()

User avatar
terra_incognita
Posts: 1913
Joined: 08/10/2007 11:43
Location: Terra Incognita

Re: Python 2.6 IOError: cannot find font file

Post by terra_incognita » 24/02/2011 19:24

..

User avatar
haro2x
Posts: 202
Joined: 08/08/2009 02:44
Location: Goa

Re: Python 2.6 IOError: cannot find font file

Post by haro2x » 24/02/2011 19:27

I Ima li taj modul za win
II Mogu li sliku spasiti u jpg fajl ili kao string ??

Hvala na pomoci

Bušman
Posts: 2123
Joined: 08/04/2008 08:48

Re: Python 2.6 IOError: cannot find font file

Post by Bušman » 24/02/2011 21:10

haro2x wrote:I Ima li taj modul za win
II Mogu li sliku spasiti u jpg fajl ili kao string ??

Hvala na pomoci


1. Trebalo bi da ima;
2. Jebo windows :D

User avatar
terra_incognita
Posts: 1913
Joined: 08/10/2007 11:43
Location: Terra Incognita

Re: Python 2.6 IOError: cannot find font file

Post by terra_incognita » 24/02/2011 22:17

..

User avatar
haro2x
Posts: 202
Joined: 08/08/2009 02:44
Location: Goa

Re: Python 2.6 IOError: cannot find font file

Post by haro2x » 24/02/2011 22:18

Code: Select all

if Jebo Windows == True:
    print("You are not gay")


Hahahahahha ma ovaj projekat je samo za win :-) , a inace koristim Ubuntu.
Eto potrazicu malo po netu za opencv na win.
Hvala na pomoci
pozz

Post Reply