I got this error "Failed to excute script camera". [closed]

asked 2019-03-21 00:04:48 -0600

Son Le gravatar image

updated 2019-03-21 11:53:09 -0600

supra56 gravatar image

Hello fellows, I have problem with building python code that has opencv imported in it, the error message when I run app is "Failed to excute script camera" (it is a desktop app). Below is my code, can you try to build it as exe file and run?

import cv2
cap = cv2.VideoCapture(0)
while(True):
    ret, frame = cap.read()
    rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)
    cv2.imshow('frame', rgb)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        out = cv2.imwrite('capture.jpg', frame)
        break
cap.release()
cv2.destroyAllWindows()

Thank in advance!!!!!!!!!!

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2019-03-22 01:53:50.050666

Comments

the code you show cannot throw the error in the title, so there must be more / something else ?

how do you actually try to run it ?

berak gravatar imageberak ( 2019-03-21 02:12:58 -0600 )edit

I meant after building the code and run the application it shows that error. Can you try to build that code i pasted above?

Son Le gravatar imageSon Le ( 2019-03-21 02:29:44 -0600 )edit
  • "building the code" -- what does it mean exactly ? (python is a interpreted language, it does not "build" anything)
  • "run the appliication" -- again , which "application", and how, exactly ?
berak gravatar imageberak ( 2019-03-21 02:34:22 -0600 )edit

I have that code above and now I use PyInstaller to convert it to .exe file to run it on Windows. Application in my opinion means the app (.exe file) created after converting.

Son Le gravatar imageSon Le ( 2019-03-21 02:44:01 -0600 )edit

opencv is not in the list

LBerger gravatar imageLBerger ( 2019-03-21 03:12:42 -0600 )edit

@Son Le -- there are a couple of posts, trying to use PyInstaller -- none of them with any success.

do you absolutely have to use it ? it looks like an unnessecary complication (since you also seem to be quite new to all of this)

berak gravatar imageberak ( 2019-03-21 03:40:46 -0600 )edit

What I need is to convert my code to .exe file with opencv included. I can try other but I dont know anything else but PyInstaller. Do you have any suggestion?

Son Le gravatar imageSon Le ( 2019-03-21 05:29:18 -0600 )edit

@LBerger: what list please?

Son Le gravatar imageSon Le ( 2019-03-21 05:47:55 -0600 )edit

@Son Le -- advice: forget the idea.

those installers work nicely with pure python code, but opencv is mainly a c++ library, all the code is inside cv2.pyd/so, and you won't ever get something really portable.

also, all of this is quite off-topic, imho.

berak gravatar imageberak ( 2019-03-21 12:17:54 -0600 )edit