Skip to content

Unknown Error, "Maybe there's an unclosed paren or quote mark somewhere before this line?" #1067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mbennette68 opened this issue Apr 29, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@mbennette68
Copy link

Most appropriate sub-area of Processing 4?

Other (specify if possible)

Processing version

4.4.1

Operating system

Ubuntu 24.04.2 LTS GNOME

Steps to reproduce this

The following code in the image fails at Line 20, in Processing 4.4.1 using Python Mode for Processing 4 4001.
It's just a simple class.

Is Python 3 supported in Processing 4.4.x and higher?

Image

Thank you,
MB

snippet

// Paste your code below :)

def setup():
    size(400,400)
    background(255)
    
def draw():
    background(255)
    fill(0, 102, 153)
    ellipse(mouseX, mouseY, 50, 50)

class Rectangle:
    def __init__(self, width, height, color):
        self.width = width
        self.height = height
        self.color = color

    def area(self):
        return self.width * self.height
            
    def display_info(self):
        print(f"Width {self.width}, height {self.height}, and color {self.color}")

rect1 = Rectangle(10,5,'red')
rect2 = Rectangle(8,4,'blue')

print(rect1.width)
print(rect2.color)

Additional context

Seems to fail on that print() statement.

It seems to work as a regular python script, outside of
processing but just in case, am I doing something wrong?

Would you like to work on the issue?

No. I don't know how to fix this issue.

@mbennette68 mbennette68 added the bug Something isn't working label Apr 29, 2025
@SableRaf
Copy link
Collaborator

SableRaf commented Apr 29, 2025

Hello @mbennette68 and thanks for your question!

You're using f-strings (formatted string literals):

print(f"Width {self.width}, height {self.height}, and color {self.color}")

While f-strings were introduced in Python 3.6, Processing.py relies on Jython, which only supports Python 2. Processing.py was never fully ported to Processing 4, and the Python Mode doesn't have an active maintainer. Because of this, there's no straightforward path to supporting Python 3, and we don't expect Python Mode to work reliably in Processing 4.

As it stands, options are as follows:

  • Use Processing 3.5.4 with Python Mode for Processing 3 and use Python 2 syntax
  • Switch to py5, which supports Python 3 and is actively developed (outside the PDE for now)

See: #350 (comment)

@mbennette68
Copy link
Author

Ok, thank you for letting me know :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants