Skip to content
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

Running a sketch on Windows returns "Process ended with exit code 3221226356." #64

Open
kemesarosh opened this issue Oct 4, 2024 · 21 comments

Comments

@kemesarosh
Copy link

kemesarosh commented Oct 4, 2024

I've tried running a py5 sketch on several Windows machines and all return a "Process ended with exit code 3221226356" error, which I believe is a heap corruption error. No problems on Mac.

thonny version: 4.1.4
py5 plug-in version: 0.10.2a0

py5_error

When I select the About thonny-py5mode dropdown option from py5 taskbar, a window opens with the following:

Internal Error
Traceback (most recent call last):
  File "C:\Users\kemesarosh\AppData\Local\Programs\Thonny\lib\tkinter\__init__.py", line 1921, in __call__
    return self.func(*args)
  File "C:\Users\kemesarosh\AppData\Local\Programs\Thonny\lib\site-packages\thonny\workbench.py", line 1109, in dispatch_from_menu
    dispatch(None)
  File "C:\Users\kemesarosh\AppData\Local\Programs\Thonny\lib\site-packages\thonny\workbench.py", line 1035, in dispatch
    handler()
  File "C:\Users\kemesarosh\AppData\Roaming\Thonny\plugins\Python310\site-packages\thonnycontrib\thonny-py5mode\about_plugin.py", line 120, in open_about_plugin
    ui_utils.show_dialog(AboutDialog(get_workbench()))
  File "C:\Users\kemesarosh\AppData\Roaming\Thonny\plugins\Python310\site-packages\thonnycontrib\thonny-py5mode\about_plugin.py", line 81, in __init__
    + '\n Python ' + get_python_version_string(maxsize=sys.maxsize)
TypeError: get_python_version_string() got an unexpected keyword argument 'maxsize'
@villares
Copy link
Collaborator

villares commented Oct 4, 2024

Hi @kemesarosh! Thank you for your report!

I think I had seen the "about" problem before, it should be fixed in the next plug-in release... #60

But the "Process ended with exit code 3221226356." seems new and I hope you can help us figure it out to fix it!

  • Is this the portable Thonny with py5 preinstalled (from here) ?
  • Can you please elaborate on which version of Windows you are using?
  • Do "module mode" py5 sketches work (with the plug-in disabled, using import py5 etc.) ?

@kemesarosh
Copy link
Author

kemesarosh commented Oct 4, 2024 via email

@villares
Copy link
Collaborator

villares commented Oct 4, 2024

Oh, thank you!

I really hope we can fix this soon, but I don't have access to a Windows 11 machine right now to test.

I could quickly update my page if you can confirm that that Thonny 4.1.6 works (from https://github.com/thonny/thonny/releases/tag/v4.1.6 or even https://thonny.org/)

And please let me know if the portable works too... Next week I might be able to work on a new portable if necessary.

@kemesarosh
Copy link
Author

kemesarosh commented Oct 4, 2024 via email

@villares
Copy link
Collaborator

villares commented Oct 4, 2024

Hmmm, strange... And, oh, this is the portable that has py5 and the py5 plug-in preinstalled (not in Thonny's site): https://github.com/villares/thonny-portable-with-py5/releases/download/2024-07-13/thonny-414-with-py5-windows-portable.zip

Beware that the portable might be looking for libraries installed by previous Thonny at the user folder instead of its own site-packages, you might want to remove (or temporarily rename) \Users\<username>\AppData\Roaming\Python\Python3<?>\site-packages.

@kemesarosh
Copy link
Author

kemesarosh commented Oct 4, 2024 via email

@villares
Copy link
Collaborator

villares commented Oct 6, 2024

Oh dear, I'm sorry to hear that. Thanks for the patience and effort testing. I'll see if I can find some Windows 11 to test in the next weeks.

@villares
Copy link
Collaborator

villares commented Oct 6, 2024

Something that came to my mind, a long shot but might bring new information... could you try different renderers like size(400, 400, P2D) or size(400, 400, P3D) ?

Ref: https://py5coding.org/reference/sketch_size.html

@villares
Copy link
Collaborator

villares commented Oct 6, 2024

Yet another idea... can you follow the "anaconda/miniconda env" install method as described in https://py5coding.org/content/install.html#anaconda-or-miniconda-setup ? Then we could check if py5 works on another (conda managed) Python env in your computer and it is often possible to point Thonny to use that Pyhon interpreter instead of its own.

@kemesarosh
Copy link
Author

kemesarosh commented Oct 6, 2024 via email

@kemesarosh
Copy link
Author

kemesarosh commented Oct 6, 2024 via email

@villares
Copy link
Collaborator

villares commented Oct 6, 2024

I really want to understand and have this fixed :(

I don't know if this would be useful but, FYI:

  • On Thonny's Tools > Options... > Interpreters (tab) you can try pointing it to the Python executable of your conda env. And then you could use Thonny's Options.. > General (tab) to set the JAVA_HOME.
  • As an emergency solution in class I sometimes use this pyodide based editor in the browser (not the same as py5 but usable for basic stuff) https://abav.lugaralgum.com/pyp5js/py5mode

Note: lots of typos in this as I quickly replied, sorry... your email copy must have been completely cryptic.

@kemesarosh
Copy link
Author

kemesarosh commented Oct 6, 2024 via email

@villares
Copy link
Collaborator

villares commented Oct 6, 2024

Is there a way to install the previous py5 plug-in for Thonny?

Maybe from releases but I'm not sure if 0.8.0a2 is there.

You could try copying your files in a thumb-drive and overwriting the folder inside site-packages with your version too, maybe? Maybe copying the whole Thonny folder in a thumb-drive?

I have these older versions on my dropbox:
2024 https://www.dropbox.com/scl/fi/2mnhk1k1yj6ab55p02z6q/thonny-4-with-py5-100-windows-portable.zip?rlkey=0du7vkd2nn2etlwftqw69hq1t&st=7okw431o&dl=0
2023 https://www.dropbox.com/scl/fi/ytyzpuyjmtmc5is6dwq3b/thonny-4-with-py5-091-windows-portable.zip?rlkey=ff5kxmyng4ebr1faglaej9zou&st=c8c34so9&dl=0
2022 https://www.dropbox.com/scl/fi/lmc0cy3ipxhenqei8fvqf/thonny-4-with-py5-windows-portable.zip?rlkey=8xln225daitaj1fdgixk92cr1&st=lwb061xl&dl=0

@hx2A
Copy link
Collaborator

hx2A commented Oct 7, 2024

Hi, @kemesarosh ! I will do what I can to help you.

As I said, it works fine on Mac, but since the June(?) update, py5 mode on Windows returns the error.

Are you seeing this on all Windows machines, or just a few of them?

What if you run a generic python interpeter and run import py5. Does it crash then? What about if try that in Thonny, without the plugin?

If either of those fail, can you try:

import jpype

jpype.startJVM()

There might be something off about with the Java install on these machines. Can you tell me which Java JRE is installed? Both the version and who maintains it (ie openjdk, oracle, etc).

What I'm wanting is to get it working in Thonny for my introduction to programming class

Out of curiosity, can you tell me more about your class? I do like to learn more about how py5 is being used.

@kemesarosh
Copy link
Author

kemesarosh commented Oct 8, 2024 via email

@hx2A
Copy link
Collaborator

hx2A commented Oct 8, 2024

I tried the Thonny py5mode on an older HP desktop and on a new Dell laptop,
as well as had a colleague try it on her Windows machine (not sure what she
has). All gave the same error.

Hmmm, interesting that you get the same error on so many machines, and yet @villares and I have not experienced this ourselves on Windows. These are all Windows 11, right? These are all school computers?

I can get the py5 library running on VSCode with pip install and import
py5. I'm tried to get it running on the school lab computers using
anaconda's python, but JAVA_HOME is not set up on them and py5 can't find
it, but the lab director says he can write a script to get it working.

The install instructions mention using the Python library install-jdk to install Java. It will install the JRE to a location that py5 knows about and will check for. You might be able to use this approach if for some reason the JAVA_HOME approach didn't work out. Also, this might be worth a try anyway because your bad exit codes could be caused by something funny with the JREs installed on these computers.

I can find a workaround for now, but I would just like to see if the Thonny
py5 plug-in can be fixed for Windows so that in future classes i can use
that in my introduction to programming classes as it is a simple
one-download set up (I also teach online sections).

Yes, absolutely. @villares and I both want simple and easy setups for our users!

We now have so many non-Computer Science majors taking the class that are
totally new to programming that I think it will be helpful and more
interesting to start out with visual and creative projects using Py5. I
plan on having the students use basic shapes to create geometric art, and
gradually introduce variables, conditions, loops, lists, etc. to create
more complex patterns and move into animations.

Neat. @villares has a similar approach for his classes.

@kemesarosh
Copy link
Author

kemesarosh commented Oct 8, 2024 via email

@kemesarosh
Copy link
Author

kemesarosh commented Oct 8, 2024 via email

@hx2A
Copy link
Collaborator

hx2A commented Oct 8, 2024

The school now has a new software approval policy that states all software
we use has to meet ADA accessibility requirements, which Thonny does not.

Wait, really? Thonny does not meet ADA accessibility requirements? I'm surprised. I remember being on a mailing list of blind or low vision Python folks and they liked Thonny because it was beginner friendly. Do I misremember this? Maybe there are other problems with Thonny?

In any case I do respect your school's policy here, it is a good thing to take this issue seriously.

I'm assuming from previous GitHub comments that adding accessibility
features to Thonny is not planned.

I'm disappointed to hear this.

I know from doing accessibility work that programming something to be accessible works best if you build it that way from the start. Trying to add accessibility features later is much more work. Still, it is important, especially if you want your tool to be beginner friendly and to be used on schools.

I do use VSCode and note that they always talk about improvements to accessibility features in their monthly release notes. It is a big program though with a lot of features that perhaps would be intimidating to someone new to programming. Pycharm is accessible? Is it more beginner friendly?

What other Python editors are accessible that you know of? I just looked up Mu editor and I see their most recent open issue is about accessibility. It was opened on September 2nd, with no replies. Not a good sign.

@hx2A
Copy link
Collaborator

hx2A commented Oct 8, 2024

I just looked up Thonny + accessibility:

https://github.com/thonny/thonny/issues?q=accessibility

One of them says:

I am aware of the needs of blind users, but unfortunately, the UI toolkit used in Thonny (Tk) does not support screen readers.

I've considered bolting on some support on Thonny's side, but it still requires a C programmer knowledgeable in accessibility API-s for Windows, macOS and Linux.

I see what you are saying. Thonny isn't going to become accessible anytime soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants