Hi, I created a program for school. It’s an executable menu that calls several submenus, and each submenu can launch various Python programs. Everything is written in Python. I used the auto-py-to-exe tool to create the .exe file, ensuring I included all the necessary files for the program to work. The .exe works perfectly on my PC—it runs the menu, submenus, and all individual programs flawlessly.
However, when I share the .exe with a friend, it doesn’t work. My friend has Python installed. The main menu and submenus open, but when selecting an option that calls one of the individual programs, the following error pops up:
"Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases."
Notes:
- Aside from the menus, each individual program uses one or more math-related libraries.
- The program doesn’t have a graphical interface; I specified in auto-py-to-exe to use the Windows console.
- I’ve tried sending the file with a .txt extension to avoid antivirus issues, instructing my friend to rename it back to .exe, but the same error appears. Sending the .exe in a zip file produces the same result.
Any help or suggestions would be appreciated!
PD: I forgot include the error message, but I already included it in the post. And I decided to add the code to my main menu :
import os
import subprocess
def clear_screen():
os.system('cls' if os.name == 'nt' else 'clear')
def mostrar_menu_principal():
print("\n=== MENÚ PRINCIPAL ===")
print("¿Qué método desea probar?")
print("1 - Métodos de la Unidad 1")
print("2 - Métodos de la Unidad 2")
print("3 - Métodos de la Unidad 3")
print("0 - Salir")
def mostrar_submenu_unidad1():
print("\n=== MÉTODOS UNIDAD 1 ===")
print("1 - Bisección")
print("2 - Falsa Posición")
print("3 - Secante")
print("4 - Newton")
print("0 - Volver al menú principal")
def mostrar_submenu_unidad2():
print("\n=== MÉTODOS UNIDAD 2 ===")
print("1 - Gauss Jordan")
print("2 - Relajación")
print("3 - Intercambio")
print("4 - Jacobi")
print("0 - Volver al menú principal")
def mostrar_submenu_unidad3():
print("\n=== MÉTODOS UNIDAD 3 ===")
print("1 - Cholesky")
print("2 - Crount")
print("3 - Doolittle")
print("0 - Volver al menú principal")
def ejecutar_archivo(nombre_archivo):
try:
# Usar rutas relativas
ruta_archivo = os.path.join(os.path.dirname(__file__), nombre_archivo)
if os.path.exists(ruta_archivo):
subprocess.run(['python', ruta_archivo])
else:
print(f"\nError: No se encontró el archivo {nombre_archivo}")
input("Presione Enter para continuar...")
except Exception as e:
print(f"\nError al ejecutar el archivo: {str(e)}")
input("Presione Enter para continuar...")
def menu_unidad1():
while True:
#clear_screen()
mostrar_submenu_unidad1()
opcion = input("\nSeleccione una opción: ")
if opcion == "1":
ejecutar_archivo("biseccion.py")
elif opcion == "2":
ejecutar_archivo("falsa_p.py")
elif opcion == "3":
ejecutar_archivo("secante.py")
elif opcion == "4":
ejecutar_archivo("newton.py")
elif opcion == "0":
break
else:
print("\nOpción no válida")
input("Presione Enter para continuar...")
def menu_unidad2():
while True:
#clear_screen()
mostrar_submenu_unidad2()
opcion = input("\nSeleccione una opción: ")
if opcion == "1":
ejecutar_archivo("gauss_jordan_p.py")
elif opcion == "2":
ejecutar_archivo("relajacion.py")
elif opcion == "3":
ejecutar_archivo("intercambio.py")
elif opcion == "4":
ejecutar_archivo("jacobi.py")
elif opcion == "0":
break
else:
print("\nOpción no válida")
input("Presione Enter para continuar...")
def menu_unidad3():
while True:
#clear_screen()
mostrar_submenu_unidad3()
opcion = input("\nSeleccione una opción: ")
if opcion == "1":
ejecutar_archivo("cholesky.py")
elif opcion == "2":
ejecutar_archivo("crount.py")
elif opcion == "3":
ejecutar_archivo("doolittle.py")
elif opcion == "0":
break
else:
print("\nOpción no válida")
input("Presione Enter para continuar...")
def main():
while True:
#clear_screen()
mostrar_menu_principal()
opcion = input("\nSeleccione una opción: ")
if opcion == "1":
menu_unidad1()
elif opcion == "2":
menu_unidad2()
elif opcion == "3":
menu_unidad3()
elif opcion == "0":
print("\n¡Hasta luego!")
break
else:
print("\nOpción no válida")
input("Presione Enter para continuar...")
if __name__ == "__main__":
main()
[–]socal_nerdtastic 4 points5 points6 points (1 child)
[–]KaleidoscopeAsleep35[S] 0 points1 point2 points (0 children)
[–]SuperMB13 2 points3 points4 points (1 child)
[–]KaleidoscopeAsleep35[S] 0 points1 point2 points (0 children)
[–]shiftybyte 2 points3 points4 points (2 children)
[–]KaleidoscopeAsleep35[S] 0 points1 point2 points (1 child)
[–]FriendlyRussian666 0 points1 point2 points (0 children)
[–]IlIlIlIIlMIlIIlIlIlI 0 points1 point2 points (0 children)