typemytype / drawbot

http://www.drawbot.com
Other
398 stars 61 forks source link

DrawBot as a module in python 3.11 does not work properly #493

Closed bennettzug closed 1 year ago

bennettzug commented 1 year ago

When importing drawbot as a module (python v3.11.0), calling commands does not work properly. Everything seems to need to access the protected method ._drawBotDrawingTool. For example, drawBot.newDrawing() does not work, but drawBot._drawBotDrawingTool.newDrawing() does. A workaround for this for now is to import the module and then define a variable equal to drawBot._drawBotDrawingTool, but this is a little hacky. That would look something like this, which makes a simple drawing without throwing any errors:

import drawBot as messedupdrawbot
drawBot = messedupdrawbot._drawBotDrawingTool

drawBot.newDrawing()
drawBot.newPage(500, 500)
drawBot.fill(0,0.5,0.5)
drawBot.rect(100,100,400,400)
drawBot.saveImage('image.jpg')
drawBot.endDrawing()
justvanrossum commented 1 year ago

I cannot reproduce this. Can you give the exact traceback? On which OS are you? Intel or M1?

bennettzug commented 1 year ago

Ok, turns out code runs fine, but the linter I'm using (pylint) has issues with it, and VS Code doesn't see any of the functions. Don't know which end the issue is on. Here's the pylint error: Module 'drawBot' has no 'endDrawing' memberPylint(E1101:no-member). I'm on an M1 Pro MBP, running macOS 13.1 Beta, and VSCode 1.73.1.

justvanrossum commented 1 year ago

Perhaps related to #440. I don't use VSCode nor pylint: PRs welcome.

bennettzug commented 1 year ago

Yep, looks to be the same issue. I'll see if I can dig into it.