python exe erro

asked 2018-09-14 13:39:46 -0500

Aleander gravatar image

I'm trying to create an EXE from an object-detector code I made but the following errorimage description

codigo
    import dlib
import cv2
import sys
import imutils
from imutils.video import VideoStream

ip = "rtsp://admin:Infominas@192.168.100.229/doc/page/preview.asp"
detector = dlib.simple_object_detector('C:/detectordeobjetos/ia.svm')

Nome = 'Detector de Objetos'
fonte = cv2.FONT_ITALIC

captura = VideoStream(ip).start()

x = 0
tempo = 0
sinal = 0

while True:
    from datetime import datetime
data_e_hora_atuais = datetime.now()
data_e_hora_em_texto = data_e_hora_atuais.strftime('%d/%m/%Y %H:%M')


frame = captura.read()
frame = imutils.resize(frame, 1200)
#1200 = mais que 2 horas
#1300 = n tes
#1400 = n tes
frame = cv2.cvtColor(frame ,cv2.COLOR_BGR2GRAY)
sinal += 1
print(sinal)
objetosDetectados = detector(frame, 1)
for o in objetosDetectados:
    e, t, d, f = (int(o.left()), int(o.top()), int(o.right()), int(o.bottom()))
    cv2.rectangle(frame, (e, t), (d, f), (0, 220, 0), 1)
    cv2.putText(frame, 'Eixo Detectado', (e, t), fonte, 1.0, (0, 255, 0), 2, cv2.LINE_4)
    print("Objeto foi detectado")

    sinal = 0
    #v2.destroyAllWindows()
    #time.sleep(60)
if sinal == 5:
    xml = ("""<?xml version="1.0" encoding="iso-8859-1"?>
                <calls>
                <call>
                <id>0000</id>
                <mac>0013A20040A768C4</mac>
                <bat>2.23</bat>
                <dthora>""" + str(data_e_hora_em_texto) + """</dthora> </call> </calls>""")
    url = 'http://mmscon.cnhindustrial.ind.br/cnhind/mms/cebh/roti01.php'
   # r = requests.post(url, {'data': xml}).text
    #print(r)


#       cv2.destroyAllWindows()
#        time.sleep(1200)
        sinal = 0
    cv2.imshow("Frame", frame)
    if cv2.waitKey(1) & 0xAA == 27:
            break

captura.release()
cv2.destroyAllWindows()
captura.stop()
sys.exit(0)

form that creates the exe pyinstaller --onefile program.py

edit retag flag offensive close merge delete

Comments

please replace the silly and unuseable screenshot of your error msg with a text version, thank you!

berak gravatar imageberak ( 2018-09-14 13:46:42 -0500 )edit

you're a python noob. those never learn murphy's law.

berak gravatar imageberak ( 2018-09-14 13:48:45 -0500 )edit

please also refrain from using your natural language for variable names or comments.

given, that you have to ask on the net , one day or the other -- any (broken) english is better, than what you have now.

berak gravatar imageberak ( 2018-09-14 13:51:45 -0500 )edit

btw, this is THE MOST COMMON ERROR, python noobs suffer from, -- is it really out of reach to hoogle it ?

berak gravatar imageberak ( 2018-09-14 13:53:39 -0500 )edit

just check your input, mate, and you'll be safe.

berak gravatar imageberak ( 2018-09-14 13:55:01 -0500 )edit