Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4397

Python • Errors with p5 and Target Practice Tutorial

$
0
0
Hello, I am attempting to do the python tutorials. I have tried using the online code editor and my raspberrypi 4 B with Thonny. I just fired up my pi for the first time yesterday with basic raspbian setup.

Here is the code that is provided:

Code:

# Import library codefrom p5 import *from random import randint# The mouse_pressed function goes here# The shoot_arrow function goes heredef setup():    # Setup your game here    size(400, 400)def draw():    # Things to do in every frame    fill('cyan')    rect(0, 0, 400, 250)# Keep this to run your coderun(frame_rate=2)

With the online code editor I get errors like this:
ExternalError: TypeError: Cannot read properties of undefined (reading 'sketch') on line 2 of main.py

on my pi with thonny, I get an error saying:
PROBLEM IN THONNY'S BACK END: Exception while handling 'Run' (ValueError: AST node line range (1000000, 1) is not valid).

I don't really know what I'm supposed to do when even the provided editor throws errors with the provided, unmodified code.

Thanks.

Statistics: Posted by HyperionOwl — Wed Aug 21, 2024 7:26 pm — Replies 2 — Views 25



Viewing all articles
Browse latest Browse all 4397

Trending Articles