Discuss Scratch
- Discussion Forums
- » Connecting to the Physical World
- » Enchanting 2 (run Snap! in a python interpreter) underway
- clintonb
-
19 posts
Enchanting 2 (run Snap! in a python interpreter) underway
Hello everyone.
I'm the lead developer on Enchanting, and, with new hardware, it is time for Enchanting 2!
I've made a video and written a brief article about the goals of the project.
Enchanting2 runs Snap! code (and it is possible to convert Scratch code to the Snap! XML format) in an “execution engine” written in cross-platform Python. It uses some neat technologies like PyGame, gevent coroutines, and websockets. It is at a very early stage, but it does work.
I'm looking forward to making it so kids can program robots in a lively fashion. I definitely want to see it on the Raspberry Pi, and I'll sure try to make it run on LEGO Mindstorms EV3. If you'd like to help, join our mailing list, spread the word, or get the code from github!
I'm the lead developer on Enchanting, and, with new hardware, it is time for Enchanting 2!
I've made a video and written a brief article about the goals of the project.
Enchanting2 runs Snap! code (and it is possible to convert Scratch code to the Snap! XML format) in an “execution engine” written in cross-platform Python. It uses some neat technologies like PyGame, gevent coroutines, and websockets. It is at a very early stage, but it does work.
I'm looking forward to making it so kids can program robots in a lively fashion. I definitely want to see it on the Raspberry Pi, and I'll sure try to make it run on LEGO Mindstorms EV3. If you'd like to help, join our mailing list, spread the word, or get the code from github!
Last edited by clintonb (Aug. 14, 2014 18:41:00)
- Hardmath123
-
1000+ posts
Enchanting 2 (run Snap! in a python interpreter) underway
No way, Enchanting2 runs Snap!? Brilliant. (You might remember me from the original Enchanting, I took an Enchanting-based bot to a competition and didn't lose.
)
Are you using Snapin8r for the conversion? If so, there's an original Python-based Snapin8r lying around somewhere which might work better for a Python-based solution—I originally wrote Snapin8r in Python but ported it to JS hoping Jens would merge it into Snap! (hasn't happened yet).

Are you using Snapin8r for the conversion? If so, there's an original Python-based Snapin8r lying around somewhere which might work better for a Python-based solution—I originally wrote Snapin8r in Python but ported it to JS hoping Jens would merge it into Snap! (hasn't happened yet).
- Hardmath123
-
1000+ posts
Enchanting 2 (run Snap! in a python interpreter) underway
(I'd love to help out with this, by the way: I speak Morphic and Python.)
For others: the code's on Github at https://github.com/clintonblackmore/enchanting2
For others: the code's on Github at https://github.com/clintonblackmore/enchanting2
- clintonb
-
19 posts
Enchanting 2 (run Snap! in a python interpreter) underway
Hi Hardmath123.
You wrote Snapin8r? That's awesome.
I was actually just content to tell people Scratch files could be converted. It'd be slick to be able to load Scratch files as part of the process, and then convert them to Snap – really slick.
Your original code is in Python, eh? What would you think about having it integrated into Enchanting 2 (noting that it is under an AGPL license – but then again, so is Snap, so I don't think that's a sticking point).
I would love, love, love to have your help. Not many people speak Morphic, and my Javascript feels rusty!
(I'm happy to have help from other people who'd like to assist, too.)
Cheers,
Clinton
You wrote Snapin8r? That's awesome.
I was actually just content to tell people Scratch files could be converted. It'd be slick to be able to load Scratch files as part of the process, and then convert them to Snap – really slick.
Your original code is in Python, eh? What would you think about having it integrated into Enchanting 2 (noting that it is under an AGPL license – but then again, so is Snap, so I don't think that's a sticking point).
I would love, love, love to have your help. Not many people speak Morphic, and my Javascript feels rusty!
(I'm happy to have help from other people who'd like to assist, too.)
Cheers,
Clinton
- djdolphin
-
1000+ posts
Enchanting 2 (run Snap! in a python interpreter) underway
Awesome! I was hoping there'd be a version of Enchanting ported to Snap!. I'd like to make something with my Mindstorms, but all the gears mysteriously disappeared.
Last edited by djdolphin (Aug. 8, 2014 20:38:07)
- Hardmath123
-
1000+ posts
Enchanting 2 (run Snap! in a python interpreter) underway
It's Python, but it's really outdated—it was made during the late beta of Scratch 2.0. At some point, I did a blind port of it to JS hoping that Jens would merge it into the main Snap! (he didn't), and so I just maintain the JS one. I'd be happy to send you the original Snapin8r if you're willing to bring it up-to-date. However, I can also give you the glue code that lets you drag-and-drop a downloaded .sb2 file into Snap! itself. This would be far more current (though still pretty glitchy, of course).
- Hardmath123
-
1000+ posts
Enchanting 2 (run Snap! in a python interpreter) underway
With regards to licensing, I don't really care how the code's distributed as long as some attribution (i.e. a comment in the source code) points back to my Github. :-)
- clintonb
-
19 posts
Enchanting 2 (run Snap! in a python interpreter) underway
With regards to licensing, I don't really care how the code's distributed as long as some attribution (i.e. a comment in the source code) points back to my Github. :-)
That's fine with me!
- PullJosh
-
1000+ posts
Enchanting 2 (run Snap! in a python interpreter) underway
Wow! This looks like an awesome project! I can't wait to try it out! 
(Sadly, I won't be able to help, due to my extreme lack of python knowledge.)

(Sadly, I won't be able to help, due to my extreme lack of python knowledge.)
- PullJosh
-
1000+ posts
Enchanting 2 (run Snap! in a python interpreter) underway
I just installed python 2.7 and pygame, but I'm stuck at Gevent. How would one go about installing it (on windows)?
- clintonb
-
19 posts
Enchanting 2 (run Snap! in a python interpreter) underway
I just installed python 2.7 and pygame, but I'm stuck at Gevent. How would one go about installing it (on windows)?
Hi PullJosh.
I'm glad to have you trying it out. I haven't attempted installation on Windows, but it looks like you can download an installer for gevent here.
Hmm… It isn't clear to me how you'll install gevent-websocket. I'd not be surprised if you'll need to install pip, and then you should be able to do something like ‘pip install gevent_websocket’. (Honestly, it might even install gevent for you, too.)
One other thing I'm mildly concerned about is path names in the web server. If you can't get Enchanting 2 to serve files using HTTP right, let me know.
Give it a shot and let me know how it goes.
Clinton
- PullJosh
-
1000+ posts
Enchanting 2 (run Snap! in a python interpreter) underway
The gevent installer worked like a charm. Still a bit confused about the gevent_websocket. I installed pip, but I don't know what it is or how to use it. :3I just installed python 2.7 and pygame, but I'm stuck at Gevent. How would one go about installing it (on windows)?
Hi PullJosh.
I'm glad to have you trying it out. I haven't attempted installation on Windows, but it looks like you can download an installer for gevent here.
Hmm… It isn't clear to me how you'll install gevent-websocket. I'd not be surprised if you'll need to install pip, and then you should be able to do something like ‘pip install gevent_websocket’. (Honestly, it might even install gevent for you, too.)
One other thing I'm mildly concerned about is path names in the web server. If you can't get Enchanting 2 to serve files using HTTP right, let me know.
Give it a shot and let me know how it goes.
Clinton
- clintonb
-
19 posts
Enchanting 2 (run Snap! in a python interpreter) underway
The gevent installer worked like a charm. Still a bit confused about the gevent_websocket. I installed pip, but I don't know what it is or how to use it. :3
I don't suppose the python code happens to work? (I doubt gevent_websocket was installed).
How comfortable are you at the command line? I believe you'll need to run:
pip install gevent_websocket
Try the code first, and if it doesn't run, try this and run the code again.
Clinton
- PullJosh
-
1000+ posts
Enchanting 2 (run Snap! in a python interpreter) underway
1) What python code (the last two links in the first post are broken)?The gevent installer worked like a charm. Still a bit confused about the gevent_websocket. I installed pip, but I don't know what it is or how to use it. :3
I don't suppose the python code happens to work? (I doubt gevent_websocket was installed).
How comfortable are you at the command line? I believe you'll need to run:pip install gevent_websocket
Try the code first, and if it doesn't run, try this and run the code again.
Clinton
2) I kinda sorta get how it works, but I wouldn't call myself comfortable.
3) I'm getting a “'pip' is not recognized…” error.
- clintonb
-
19 posts
Enchanting 2 (run Snap! in a python interpreter) underway
I've fixed the links. Thanks for letting me know.
I've never used pip on windows. You might need to look into a tutorial. I would've assumed the computer would find it if you've installed it, but I'd not be surprised if there are subtleties I don't know.
I've never used pip on windows. You might need to look into a tutorial. I would've assumed the computer would find it if you've installed it, but I'd not be surprised if there are subtleties I don't know.
- PullJosh
-
1000+ posts
Enchanting 2 (run Snap! in a python interpreter) underway
Okay, I figured it out!
I haven't tried running the code yet, but the installer didn't throw any errors or anything.
For future windows users:
Go to this site and click the download button. Run the installer that you just downloaded, and it's pretty simple from there. A friendly little (not very command line-y)box will pop up where you can type in a pip command. Use that.
I'll be gone for the rest of today and all of tomorrow, so I'll run the code on… eh, what's that day? I've lost count of the days of the week. Anyway, I'll run it the day after tomorrow.

For future windows users:
Go to this site and click the download button. Run the installer that you just downloaded, and it's pretty simple from there. A friendly little (not very command line-y)box will pop up where you can type in a pip command. Use that.
I'll be gone for the rest of today and all of tomorrow, so I'll run the code on… eh, what's that day? I've lost count of the days of the week. Anyway, I'll run it the day after tomorrow.

- clintonb
-
19 posts
Enchanting 2 (run Snap! in a python interpreter) underway
Okay, I figured it out!I haven't tried running the code yet, but the installer didn't throw any errors or anything.
Fabulous!
- Discussion Forums
- » Connecting to the Physical World
-
» Enchanting 2 (run Snap! in a python interpreter) underway