internal error message after running
Posted: Wed Aug 04, 2021 1:57 pm
hey guys, we have a program that we want to run on micropython Thonny, but when we press run ,the error below is what we get... what could the problem be? we are beginners on micropython..we are using the raspberry pi pico and sim800l.
Traceback (most recent call last):
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\site-packages\thonny\workbench.py", line 1957, in toolbar_handler
handler(*args)
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\site-packages\thonny\running.py", line 405, in cmd_run_current_script
self.execute_current("Run")
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\site-packages\thonny\running.py", line 354, in execute_current
filename = get_saved_current_script_filename()
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\site-packages\thonny\editors.py", line 1076, in get_saved_current_script_filename
filename = editor.save_file()
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\site-packages\thonny\editors.py", line 273, in save_file
result = self.write_local_file(save_filename, content_bytes, save_copy)
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\site-packages\thonny\editors.py", line 287, in write_local_file
f = open(save_filename, mode="wb")
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\mainforSim800l.py'
below is the program we are trying to run
Traceback (most recent call last):
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\site-packages\thonny\workbench.py", line 1957, in toolbar_handler
handler(*args)
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\site-packages\thonny\running.py", line 405, in cmd_run_current_script
self.execute_current("Run")
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\site-packages\thonny\running.py", line 354, in execute_current
filename = get_saved_current_script_filename()
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\site-packages\thonny\editors.py", line 1076, in get_saved_current_script_filename
filename = editor.save_file()
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\site-packages\thonny\editors.py", line 273, in save_file
result = self.write_local_file(save_filename, content_bytes, save_copy)
File "C:\Users\suppo\AppData\Local\Programs\Thonny\lib\site-packages\thonny\editors.py", line 287, in write_local_file
f = open(save_filename, mode="wb")
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\mainforSim800l.py'
below is the program we are trying to run
Code: Select all
import machine
from machine import UART, Pin
import utime
from time import sleep
sensor_adc1_pir = machine.Pin(27, machine.Pin.IN, machine.Pin.PULL_DOWN)
sensor_adc2_pir2 = machine.Pin(28, machine.Pin.IN, machine.Pin.PULL_DOWN)
standdown_pir3 = machine.Pin(5, machine.Pin.IN, machine.Pin.PULL_UP)
sensor_dig1_pir4 = machine.Pin(14, machine.Pin.IN, machine.Pin.PULL_DOWN)
sensor_dig2_pir5 = machine.Pin(15, machine.Pin.IN, machine.Pin.PULL_DOWN)
bluelock_pir6 = machine.Pin(6, machine.Pin.IN, machine.Pin.PULL_DOWN)
outputrelay = machine.Pin(4, machine.Pin.OUT)
test_led = machine.Pin(8, machine.Pin.OUT)
activate = machine.Pin(7, machine.Pin.OUT)
def read_all(gsm):
c = b""
while gsm.any():
c += gsm.read(1)
sleep(0.0007)
print(c)
# Create the UART connection
gsm = UART(0, 9600, tx=Pin(0), rx=Pin(1))
sleep(0.5)
activate.on()
def pir_handler(pin):
if pin.value():
if pin is sensor_adc1_pir:
print("Alarm! sensor_adc1!")
test_led.value(1)
utime.sleep(0.2)
test_led.value(0)
elif pin is sensor_adc2_pir2:
print("Alarm! sensor_adc2!")
test_led.value(1)
utime.sleep(0.2)
test_led.value(0)
elif pin is sensor_dig1_pir4:
print("Alarm! sensor_dig1!")
test_led.value(1)
utime.sleep(0.2)
test_led.value(0)
elif pin is sensor_dig2_pir5:
print("Alarm! sensor_dig2!")
test_led.value(1)
utime.sleep(0.2)
test_led.value(0)
elif bluelock_pir6.value() == 0:
print("bluelock access!")
outputrelay.value(1)
gsm.write('AT\r\n')
sleep(1)
read_all(gsm)
gsm.write('AT+CSQ\r\n')
sleep(1)
read_all(gsm)
gsm.write('AT+CMGF=1\r\n')
sleep(1)
read_all(gsm)
gsm.write('AT+CMGS="+27733166980"\r\ndoor opened\r\n')
sleep(1)
read_all(gsm)
gsm.write('\x1A')
sleep(1)
read_all(gsm)
utime.sleep(20)
outputrelay.value(0)
utime.sleep(0)
sensor_adc2_pir2.value(0)
utime.sleep(10)
sensor_adc1_pir.value(0)
utime.sleep(10)
sensor_dig1_pir4.value(0)
utime.sleep(10)
sensor_dig2_pir5.value(0)
utime.sleep(10)
test_led.value(1)
utime.sleep(0.2)
test_led.value(0)
elif standdown_pir3.value() == 0:
print("door closed!")
test_led.value(1)
utime.sleep(10)
test_led.value(0)
sensor_adc1_pir.irq(trigger=machine.Pin.IRQ_RISING, handler=pir_handler)
sensor_adc2_pir2.irq(trigger=machine.Pin.IRQ_RISING, handler=pir_handler)
sensor_dig1_pir4.irq(trigger=machine.Pin.IRQ_RISING, handler=pir_handler)
sensor_dig2_pir5.irq(trigger=machine.Pin.IRQ_RISING, handler=pir_handler)
standdown_pir3.irq(trigger=machine.Pin.IRQ_RISING, handler=pir_handler)
bluelock_pir6.irq(trigger=machine.Pin.IRQ_RISING, handler=pir_handler)