vale gracias, era windows 10, pero tuve que formatear el pc y se soluciono, gracias de todos modos
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú
File "/home/n1sendev/Escritorio/TarketakVOS/exe_read.py", line 22, in UnpickleExecutable
unpickled_obj = load(f)
_pickle.UnpicklingError: invalid load key, ''.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 46, in <module>
main()
File "main.py", line 35, in main
boot_func()
File "/home/n1sendev/Escritorio/TarketakVOS/boot.py", line 10, in boot_func
loginMain()
File "/home/n1sendev/Escritorio/TarketakVOS/login.py", line 44, in loginMain
maincmd()
File "/home/n1sendev/Escritorio/TarketakVOS/usr_shell.py", line 62, in maincmd
UnpickleExecutable(cmd_input)
File "/home/n1sendev/Escritorio/TarketakVOS/exe_read.py", line 24, in UnpickleExecutable
except pickle.UnpicklingError as pic_errno1:
NameError: name 'pickle' is not defined
try:
unpickled_obj = load(f)
ReadExecutebleIns(unpickled_obj, path)
except pickle.UnpicklingError as pic_errno1:
print("!Invalid binary: %s" % pic_errno1)
;TarketakVOS Assembler
STR_PRINT "Hola mundo!"
DIV("El numero 5 en 5 cabe:", 5, 5)
INT("test", "54")
from _pickle import dump, dumps, load, loads
obj = ['STR_PRINT "Hola mundo"', 'DIV("El numero 5 en 5 cabe:", 5, 5)', 'INT("test", "54")']
with open("e.cex", "wb") as f:
dump(obj, f)
from _pickle import dump, dumps, load, loads
from system_instr import *
import sys
import os
global os_name
os_name = os.name
def UnpickleExecutable(filepath):
try:
try:
file = filepath.split("'")
path = file[1]
except IndexError:
file = filepath.split('"')
path = file[1]
with open(path, "rb") as f:
#Los archivos executables .cex son creados y leidos con _pickle en binario
unpickled_obj = load(f)
ReadExecutebleIns(unpickled_obj, path)
except FileNotFoundError:
print("File not founded.")
except IndexError:
print("Usage: exe 'executable.cex'")
def ReadExecutebleIns(unpickled_obj, filename):
#Esta funcion lee las instrucciones extraidas del ejecutable
for EXEOBJ in unpickled_obj:
print(EXEOBJ)
if "STR_PRINT" in EXEOBJ: #Mustra en un texto en pantalla
PRINTSTR = EXEOBJ.split('"')
Text = PRINTSTR[1]
print(Text, flush=True)
elif "CMD_PAUSE" in EXEOBJ: #Pausa la consola
shudder_data = input("Press any key to continue... ")
shudder_data = None
elif "EXIT" in EXEOBJ: #Sale del programa
pass
elif "CLEARSCR" in EXEOBJ: #Limpia la pantalla
if os_name == 'posix':
os.system("clear")
elif os_name == 'nt':
os.system("cls")
else:
pass
elif "ADD" in EXEOBJ:
exec(EXEOBJ)
elif "SUB" in EXEOBJ:
exec(EXEOBJ)
elif "MUL" in EXEOBJ:
exec(EXEOBJ)
elif "DIV" in EXEOBJ:
exec(EXEOBJ)
elif "DIV_INT" in EXEOBJ:
exec(EXEOBJ)
elif "PUSH" in EXEOBJ:
exec(EXEOBJ)
elif ";" in EXEOBJ:
pass
else: #En caso que haya una intruccion invalida...
print('!Illegal instruction "%s" in %s' % (EXEOBJ, filename))
import os, sys
from _pickle import dump, dumps, load, loads
from system_instr import *
def ASM_File(filepath):
try:
try:
file = filepath.split("'")
path = file[1]
except IndexError:
file = filepath.split('"')
path = file[1]
PRG(path)
except IndexError:
print("Usage: tkasm 'program.asm'")
def PRG(path):
asm_file_cont = []
out_file = input("Output file name..: ")
with open(path, 'r') as inputfile:
with open(out_file, 'wb') as outputfile:
for f1 in inputfile:
f1 = [f1[:-1]]
asm_file_cont.append(" ".join(f1))#por tu ejemplo lo convierto a cadena
dump(asm_file_cont, outputfile)
#supogo que es para escribir el contenido en el otro archivo
print(asm_file_cont)
;TarketakVOS Assembler
STR_PRINT "Hola mundo!"
DIV("El numero 5 en 5 cabe:", 5, 5)
INT("test", "54")
def PRG(path):
out_file = input("Output file name..: ")
with open(path, 'r') as inputfile:
with open(out_file, 'wb') as outputfile:
for f1 in inputfile:
asm_file_cont = []
f1 = [f1[:-1]]
asm_file_cont + f1
dump(asm_file_cont, outputfile)
print(asm_file_cont)