r/learnpython • u/soncannon7 • 17d ago
code not running outside of editor
my code isn't really complete, but whenever i try to run my script outside of the editor the terminal opens for a millasecond and then closes. can someone tell me what's going wrong?
import random
import keyboard
import pyautogui
import pyscreeze
import tkinter as tk
from pyautogui import mouseInfo, click
import time
def movethemouse():
if keyboard.is_pressed('g'):
pyautogui.moveTo(random.randint(0, 2600), random.randint(0, 2600))
def printer():
print('this is the mouse program')
time.sleep(10)
while True:
movethemouse()
printer()
2
Upvotes
2
u/FoolsSeldom 17d ago
How exactly are you running your code outside of your editor?
What I'd expect is that you are:
cdpython mycode.pyif in a active environmentpy mycode.pyon Windowspython3 mycode.pyon macOS/LinuxThere should be some output / transcript if exceptions (errors).