Ошибка: объект «свойство» не подлежит подпискеPython

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Ошибка: объект «свойство» не подлежит подписке

Сообщение Anonymous »

Я действительно не знаю, почему мне это показывают. Я изменил весь свой код, но ошибка так и осталась.
Объект 'property' не подлежит подписке
ChatGPT не смог мне помочь, поэтому я пришел к мастерам :)

Код: Выделить всё

upload = False

def browse_file():
global filepath
filepath = filedialog.askopenfilename(filetypes=[("Excel Files", ".xlsx .xls")])
global dados_convenios
dados_convenios = pd.read_excel(filepath, dtype=str)
global upload
if "CNPJ" not in dados_convenios.columns:
status_label.config(text="CNPJ não encontrado!", fg="red")
button_run.configure(state="disabled")
if "Agência" not in dados_convenios.columns:
status_label.config(text="Agência não encontrada!", fg="red")
button_run.configure(state="disabled")
if "Conta"  not in dados_convenios.columns:
status_label.config(text="Conta não encontrada!", fg="red")
button_run.configure(state="disabled")
else:
status_label.config(text="Excel carregado com sucesso!", fg="green")
button_run.configure(fg_color="#ec0000", text_color="white", hover_color="#a50000", state="normal")
upload = True

def run():

if upload is False:
status_label.config(text="Nenhum arquivo foi carregado!", fg="red")
else:
dfs = np.array_split(dados_convenios, 4)
root.state("withdrawn")
new_window = tk.Toplevel(root)
new_window.title("Robô trabalhando ⚙️")
new_window.geometry("450x250")
progressbar = ttk.Progressbar(
new_window, orient="horizontal", mode="indeterminate"
)
progressbar.start(10)
progressbar.place(relx=0.5, rely=0.5, anchor="center")
label = tk.Label(new_window, text="Working...")
label.pack(pady=10)

def process_task():
try:
print("Antes")
with concurrent.futures.ThreadPoolExecutor() as executor:
results = list(executor.map(cadastrapagfor, dfs))
global log_dataframe
log_dataframe = pd.concat(results)
label.config(text="Tarefas totalmente finalizadas")
print("Depois")
except Exception as e:
print(e)
label.config(
text="Tarefas parcialmente finalizadas, verificar LOG gerado"
)

threading.Thread(target=process_task).start()

def quit():
root.quit()
root.destroy()

##########################################################
#                  ()                                    #
# ####### # ###    ##  ###  ##  #######  #######  #####  #
#   ##    ###      ##  ## # ##    ##     #        #   #  #
#   ##    ##       ##  ##  ###    ##     ####     #####  #
#   ##    #  ##    ##  ##   ##    ##     #        # #    #
#   ##    #  ##    ##  ##   ##    ##     #######  #   #  #
#                                                        #
##########################################################

root = ctk.CTk()
root.title("Robô PagFor")
root.geometry("450x250")
root.config(bg="#f0f0f0")

title = ctk.CTkLabel(root, text="Bem-vindo ao Robô PagFor :)")
title.pack(padx=5, pady=5)

subtitle = tk.Label(
root, text="Clique no botão e faça upload do arquivos de Convênios PagFor:"
)
subtitle.pack(pady=15)

button = ctk.CTkButton(root, text="Upload Convênios Pagfor", command=browse_file)
button.pack(pady=5)
button.configure(fg_color="#ec0000")
button.configure(text_color="white")
button.configure(hover_color="#a50000")

button_run = ctk.CTkButton(root, text="Start", command=run)
button_run.pack(pady=5)
button_run.configure(fg_color="gray")
button_run.configure(text_color="black")
button_run.configure(hover_color="white")

button_quit = ctk.CTkButton(root, text="Sair", command=quit).pack(pady=5)

status_label = tk.Label(root, text="", fg="black")
status_label.pack(pady=5)

root.mainloop()

try:

log_dataframe.to_excel("./Log Cadastro Pagfor.xlsx", index=False)

except Exception as e:
# Registra a exceção no log
logging.exception("Ocorreu um erro: %s", e)
Итак, я пытался изменить код, пробовал то, что мне говорит чат, пытался переписать код.
Самое ужасное Дело в том, что код работал правильно, но я хочу, чтобы он показывал поле с сообщением «Работает...», но это не работает.

Подробнее здесь: https://stackoverflow.com/questions/791 ... scriptable
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Python»