Так что это мой код, я могу запустить его на своем компьютере. Как только я перевожу его на другой компьютер через флэш-диск и пытаюсь открыть его, он читает не удалось выполнить скрипт.
Я использовал Pyinstaller с командами для -w -F -i.
Я пробовал на двух других компьютерах, кроме моего, он работает на моем, но не на других. Пожалуйста, помогите!
from wand.image import Image as wand_image
import re
import os
import Tkinter as Tk
from ttk import *
import tkMessageBox
from datetime import datetime
import threading
total_files= 0
files_finished= 0
root = Tk.Tk() #Starts the GUI.
root.resizable(False, False)
canvas= Tk.Canvas(root)
canvas.pack(fill=Tk.BOTH, expand=1)
canvas.config(width=500, height=125)
canvas.create_rectangle(0,0,500,500, fill="blue")
canvas.grid(row=0, rowspan=30, columnspan=100)
current_update= Tk.Label(root, text="... Activity Feed...", font="-weight bold", background ="cyan", width=49, height=2, border=0)
current_update.grid(row=4, column=0, columnspan=100)
current_update_display= Tk.Label(root, font="-weight bold", background ="black", foreground="white", width=49, height=2 , relief= "sunken", \
text="0 out of 0 files completed.")
current_update_display.grid(row=5, column=0, columnspan=100, sticky="N")
Progressbar= Progressbar(length=495, maximum=0)
Progressbar.grid(row=6, rowspan=30, columnspan=100)
def get_total():
global total_files
for folder in os.listdir(os.getcwd()):
if not os.path.isdir(folder) or re.search('zzz-Files Without Dates-zzz', folder):
continue
for filename in os.listdir(folder):
file_type= re.search(r"\.\w+", filename)
if file_type==None:
continue
else:
file_type= file_type.group()
new_filename= "%s%s" % (re.sub(".pdf", "", filename), " -converted_page.png")
if not re.search(".pdf", filename) or re.search(" -converted_page.png", filename) or os.path.exists(r"%s\%s" % (folder, new_filename)):
continue
elif re.match(r"%s \d{6}%s" % (folder, file_type), filename) or re.match(r"%s \d{6} \(\d+\)%s" % (folder, file_type), filename):
try:
possible_date_code= re.search(r"\d{6}", filename).group()
possible_date= datetime(month=int(possible_date_code[:2]), day=int(possible_date_code[2:4]), year=int(possible_date_code[4:])+2000)
if possible_date<datetime.now():
continue
except ValueError:
pass
total_files+=1
Progressbar.config(maximum=total_files)
current_update_display.config(text="%s out of %s files finised." % ("0", total_files))
def convert():
global total_files, files_finished
for folder in os.listdir(os.getcwd()):
if not os.path.isdir(folder) or re.search('zzz-Files Without Dates-zzz', folder):
continue
for filename in os.listdir(folder):
file_type= re.search(r"\.\w+", filename)
if file_type==None:
continue
else:
file_type= file_type.group()
new_filename= "%s%s" % (re.sub(".pdf", "", filename), " -converted_page.png")
if not re.search(".pdf", filename) or re.search(" -converted_page.png", filename) or os.path.exists(r"%s\%s" % (folder, new_filename)):
continue
elif re.match(r"%s \d{6}%s" % (folder, file_type), filename) or re.match(r"%s \d{6} \(\d+\)%s" % (folder, file_type), filename):
try:
possible_date_code= re.search(r"\d{6}", filename).group()
possible_date= datetime(month=int(possible_date_code[:2]), day=int(possible_date_code[2:4]), year=int(possible_date_code[4:])+2000)
if possible_date<datetime.now():
continue
except ValueError:
pass
with wand_image(filename=r"%s\%s" % (folder, filename),resolution=300) as source:
images=source.sequence
wand_image(images[0]).save(filename=r"%s\%s" % (folder, new_filename))
files_finished+=1
current_update_display.config(text="%s out of %s files finised." % (files_finished, total_files))
Progressbar.step(1)
root.destroy()
for interval in range(2):
if interval==0:
thread_object= threading.Thread(target=get_total)
else:
thread_object= threading.Thread(target=convert)
thread_object.daemon = True
thread_object.start()
root.mainloop()