Ask Your Question

Revision history [back]

Non-ASCII character '\xa0' in file

Hi I am a starter in Python and Opencv. I have tried for this code blow for opening a avi file:

Code:

import cv
vidFile = cv.CaptureFromFile("C:\test1.avi")
nFrames = int(cv.GetCaptureProperty( vidFile, cv.CV_CAP_PROP_FRAME_COUNT ) )
fps = cv.GetCaptureProperty( vidFile, cv.CV_CAP_PROP_FPS )

waitPerFrameInMillisec = int( 1/fps * 1000/1 )

print 'Num. Frames = ', nFrames
print 'Frame Rate = ', fps, ' frames per sec'

for f in xrange( nFram`enter code here`es ):
frameImg = cv.QueryFrame( vidFile )
  cv.ShowImage( "My Video Window",  frameImg )
  cv.WaitKey( waitPerFrameInMillisec  )
cv.DestroyWindow( "My Video Window" )

While an error happens:

Non-ASCII character '\xa0' in file C:\cantwork.py on line 5, but no encoding declared;

see python.org/dev/peps/pep-0263/ for details

Could anybody help me for this please? Appreciate