Michael Cimino

@Saibot84 (45)
I am on errantry, and I greet you!
Repl.it Classrooms
posted to Share by CodingCactus

@CodingCactus Ah! Yes, in a real-world classroom setting, I see what you mean.

Maybe a "request to unenroll" button might be more appropriate in this case. Or, depending on your point of view, maybe only allow teacher-roles to unenroll themselves from classrooms they didn't create. Anyway, it's just an idea. These new Repl.it Classrooms are AWESOME!

Repl.it Classrooms
posted to Share by CodingCactus

@CodingCactus AWESOME work!

And I agree that an Unenroll button would be great! It's easy to click an invite link ... but then what if you don't like that classroom or don't want to be in it anymore?

It would also be nice to have like a spotlight page showing the top classrooms. Maybe using a simple upvote system just like Repl Talk.

Error with all repls
posted to Ask by Ashenguard

I'm having the same problem with my python repls. I can't run my repls using the run button because poetry is having the same PermissionError you've shown.

Based on TheForArkLD's answer, I got my repl to run correctly by using the console to install the packages I needed, and then using the console to run my python code.

import subprocess
subprocess.call('bash')
pip3 install packages_names_here
python3 main.py

I'd also like to mention that I tried using a .replit file to modify the behavior of the run button, but it didn't work for me.

Using pip3 install -r requirements.txt seems to work, too, but I still have to call python3 main.py instead of using the run button.

How can I guarantee a restart of the X server from Java Swing?
posted to Ask by psb_david_petty

Try using the shell command pkill x11vnc.

Other commands to try are pkill Xorg or pkill fluxbox.

If all else fails, I believe the whole container can be forcefully restarted with the shell command pkill init

Are sockets availible in repl.it?
posted to Ask by CreateAWebsite

Great question, @CreateAWebsite!

Yes, websockets are available. Try using

HOST=''

or

HOST='0.0.0.0'

instead of

HOST='127.0.0.1'
Simplgui / Color practice
posted to Ask by MrNelson

Interesting question @MrNelson!

You could try using the SimpleGUICS2Pygame package.

You can add it using the package manager on the sidebar and looking for SimpleGUICS2Pygame

In the code, just change the first line from

import simplegui

to

try:
    import simplegui
except ImportError:
    import SimpleGUICS2Pygame.simpleguics2pygame as simplegui

For example: https://repl.it/@Saibot84/MrNelsonU1L4-color-Practice

I hope that helps.

How disable python plots and enable web server instead?
posted to Ask by fsinit

Interesting question, @fsinit !

You have to stop the x11vnc server before running the server.

For example, we can use

import os
os.system('killall x11vnc')

or

import os
os.system('pkill x11vnc')

Publicly hosted plot image:

https://matplotlib-server.saibot84.repl.co/

Fork it: https://repl.it/@Saibot84/matplotlib-server

Error with all repls
posted to Ask by Ashenguard

Update: My python repls seem to be working now. It looks like the issue was a problem with the poetry configuration, but it must have been fixed because poetry is no longer showing a PermissionError and my python repls are running fine right now.

How to use Kivy
posted to Tutorials by PaoloAmoroso

That's awesome, @PaoloAmoroso!

Unfortunately, building Kivy takes quite a while. Running your PyGame repl, it took about 15 minutes to build Kivy. When I ran mine, it crashed countless times. Re-running the code started the whole build from scratch, and it never finished before crashing.

I agree that polygott can be a bit buggy, but here's the same Kivy Showcase, but running on a polygott container where the Kivy wheel is stored (as well as those of its dependencies). This cuts the time to interactive (after clicking run) down from 15 minutes to about 1 minute.
https://repl.it/@Saibot84/Kivy-Showcase-Polygott-PreInstalled

Polygott REPL stuck downloading Pygame
posted to Ask by PaoloAmoroso

To answer your question, I've noticed that leaving the console waiting on a single program for too long seems to crash the polygott container.
This includes pip install, downloads, etc. This is probably to prevent the container from getting hung (thought I only assume that). To get around this issue, I use nohup command_here in the makefile or nohup command_here & in bash to pipe output to the nohup.out file instead of to the console.

Here's a fork of this FlapehBurd demo that works for me: https://repl.it/@Saibot84/FlapehBurd

And here are the steps I took to make it run:

  • either using makefile or by running bash, run nohup pip download -d ./ pygame You can check nohup.out to see the progress.

  • change pip install pygame to pip install --no-index --find-links=./ pygame

  • instead of using x11vnc, I changed it to use polygott's own polygott-x11-vnc so I commented the killall, Xvfb, and x11vnc commands

I hope that helps.

How to correctly setup Kivy in a Repl.it
posted to Ask by Saibot84

I've recently come back to the Polygott-Kivy-PreInstalled and found that it was broken / it wouldn't run /or it would crash when loading. So I've rebuilt it ... now using a setup.py script to handle installing kivy, and it only installs kivy it if it's not already installed.

When Kivy and Kivy-Garden gets built by pip3, it creates wheels in the /home/runner/.cache/pip/ subdirectories. Copying those wheels into the wheelhouse directory has now successfully bypassed/saved the whole build process and the repl should run almost immediately every time.

Edit: Other key ingredients for this were:

  • using pip3 download -d ./wheelhouse package_name_here to download the wheels locally
  • using pip3 install --no-index --find-links=./wheelhouse/ kivy to install using the local wheels

https://repl.it/@Saibot84/Polygott-Kivy-PreInstalled

Edited 2020-01-14

How to correctly setup Kivy in a Repl.it
posted to Ask by Saibot84

I've recently come back to this ... and after some experimentation ...

https://repl.it/@Saibot84/Polygott-Kivy-Installer-Runner
Here's a polygott repl that installs kivy from a local wheelhouse, then runs the x11 vnc server and then the python code.
It will seem to hang while installing Kivy ... but you can check the nohup.out file to see the installation progress until the server and code are started. (By the way, it seems that sending output to nohup prevents the repl from crashing.)

https://repl.it/@Saibot84/Python3-Pygame-Kivy
Here's a Python3 with Pygame repl ... that uses a requirements.txt file to install kivy. Running it looks like it hangs while building Kivy, but just wait for it to finish.

https://repl.it/@Saibot84/Polygott-Kivy-PreInstalled
Here's a polygott repl that has kivy preinstalled ... so the build runs much faster. It, too, then runs the x11 vnc server and then the python code.

Error with all repls
posted to Ask by Ashenguard

Great question, @gumickycz4 !

I don't remember which repl I was working on for this but looking at the original post ...

poetry hit an error, and it decided to uninstall six because it was no longer required. Unfortunately, without six, poetry doesn't seem to work. We can use pip3 install six and then poetry add six so that six will no longer be "accidentally" uninstalled.

Running poetry add six will add the six package to the list of dependencies in pyproject.toml

six can also be added to poetry's pyproject.toml manually by adding six = "version_num" as a line by itself under [tool.poetry.dependencies] like below:

[tool.poetry.dependencies]
python = "^3.8"
pep8 = "^1.7.1"
six = "^1.11.0"

That should solve the missing six package ... and then we can continue trying to debug why poetry failed in the first place.

If you have a repl.it link you can share, I can fork it for you and see if we can get it to run.

Error with all repls
posted to Ask by Ashenguard

@maxaitel Yes, they fixed it, but I'm not sure when. As far as I know, Repl no longer uses the requirements.txt file.

I've been using poetry to manage dependencies (instead of pip) and that has helped avoid some issues.

One thing I try sometimes when poetry starts having issues, is to delete the poetry.lock file, which should force poetry, on the next run, to rebuild it.

If deleting poetry.lock doesn't resolve it. Sometimes I've had to also delete pyproject.toml.

If you want to let Repl handle the creation of pyproject.toml, just click the run button after deleting both pyproject.toml and poetry.lock. Repl will create the toml file, guess the packages you need, and then lock/install those packages.

If you want to recreate pyproject.toml yourself, use the shell command poetry init --no-interaction to create a new pyproject.toml file. Then use poetry add package-name to add the dependencies you need.

If you have a repl.it link you can share, I can fork it for you and see if we can get it to run.

How to make Repl.it stop installing the wrong package
posted to Ask by aimstest

@aimstest, it looks like pyproject.toml lists telebot as a dependency instead of pyTelegramBotAPI.
In bash, I think you need to run the following 2 lines of code to switch the dependency:

poetry remove telebot
poetry add pyTelegramBotAPI

Though I can't test it properly.

Where are the files of installed Python packages stored?
posted to Ask by PaoloAmoroso

Hello @PaoloAmoroso

Currently, the pep8 package, if left to be installed automatically by poetry ... gets installed to

/opt/virtualenvs/python3/lib/python3.8/site-packages/pep8.py

I also imported the requests package and it's located at

/opt/virtualenvs/python3/lib/python3.8/site-packages/requests

System packages installed via the install-pkg package shell command are installed to /home/runner/.apt/usr/bin/

But there are others, for example, nano, which, (I don't know why) get installed to /home/runner/.apt/bin/. Unfortunately, /home/runner/.apt/bin/ is not in $PATH so they are not executable without a work-around.

https://repl.it/@Saibot84/Py3FindingPackages

How to make Repl.it stop installing the wrong package
posted to Ask by aimstest

I'm having a similar issue with the repl installing dummy-wx when I am trying to use wxPython ... because both packages use the same wx name.

I'm trying to use a .replit file to override it ... but I feel there has to be a better way.

EDIT
Researching my own question, upm guess is guessing that I might need the dummy-wx package. There is a .upm/store.json file that lists the guessed packages. Manually changing .upm/store.json, then doing poetry remove dummy-wx, and installing the local wxpython wheel temporarily fixes the issue.

How do I clear an X instance that still has JPanels in it
posted to Ask by psb_david_petty

@psb_david_petty have you tried running, in the console, pkill x11vnc.

If that doesn't work, you could try pkill Xorg or pkill fluxbox. They should stop the window manager / x server.

pkill init should forcefully restart the whole REPL.

how do you add the simplegui to python on programs
posted to Ask by meldumas1

@meldumas1, if you are refering to the simplegui module developed by Professor Scott Rixner for CodeSkulptor ...

You could try using the SimpleGUICS2Pygame package.

You can add it using the package manager on the sidebar and looking for SimpleGUICS2Pygame

You can use this code to import the module

try:
    import simplegui
except ImportError:
    import SimpleGUICS2Pygame.simpleguics2pygame as simplegui

I hope that helps.

How to use Kivy
posted to Tutorials by PaoloAmoroso

@PaoloAmoroso I've recently found that the polygott and python containers are now using python 3.8 ... which is not supported by Kivy 1.11.1 and this is preventing the repls from running.

But there is a Kivy version 2.0.0rc3 that works with python 3.8. Here, for example, is a Python3.8 repl (including a local copy of Kivy 2.0.0rc3) that can run the Kivy showcase Kivy-Showcase-Python38-PreInstalled

And to make the python repl run, backing up the wheels isn't necessary, if we use Kivy = "^2.0.0rc3" in pyproject.toml together with

[tool.poetry.dev-dependencies.Kivy]
url = "https://kivy.org/downloads/ci/linux/kivy/Kivy-2.0.0rc3-cp38-cp38-manylinux2010_x86_64.whl"

as seen here: Python38-Kivy-200rc3

What I can't figure out is why graphics have stopped working on polygott repls.

Kivy: Unable to find the error
posted to Ask by Coder543

Lol. Thanks @Coder543!

No, I'm actually a noob at Kivy. But I want to use REPL to learn how to use it to build apps. Happy coding!

BeeWare build error in Polygott REPL
posted to Ask by PaoloAmoroso

@PaoloAmoroso I think there should be a fork button when you click the project title (as if you're going to rename it)

Kivy not working
posted to Ask by Coder543

Very interesting challenge, @Coder543!

I just replied in your other thread, but I'll post it here, too.

The last lines of the error show

File "kivy/core/text/text_layout.pyx", line 401, in
kivy.core.text.text_layout.layout_text
TypeError: an integer is required

According to kivy.core.text.text_layout, the text size parameter should be a tuple.

In my.kv, try changing text_size: "24" to text_size: (None,24)

I hope that helps.

Kivy: Unable to find the error
posted to Ask by Coder543

Very interesting challenge, @Coder543!

The last lines of the error show

File "kivy/core/text/text_layout.pyx", line 401, in
kivy.core.text.text_layout.layout_text
TypeError: an integer is required

According to kivy.core.text.text_layout, the text size parameter should be a tuple.

In my.kv, try changing text_size: "24" to text_size: (None,24)

I hope that helps.

how can i use kivy without downgrading to python 3.7
posted to Ask by JoshuaGonzalez3

Have you tried using Kivy version 2.0.0rc3 which works for python 3.8 ?

pip3 install https://kivy.org/downloads/ci/linux/kivy/Kivy-2.0.0rc3-cp38-cp38-manylinux2010_x86_64.whl

some of the other versions can be found here:
https://kivy.org/downloads/simple/kivy/

Kivy not working
posted to Ask by Coder543

Nice work @Coder543 !

I have found that the Polygott-Kivy-Preinstalled container is now using python 3.8, which is not compatible with the preinstalled Kivy version 1.11.1

Try forking this Python 3.8 repl instead: Python38-Kivy-200rc3

How to correctly setup Kivy in a Repl.it
posted to Ask by Saibot84

2020-08-25
The polygott container used by Polygott-Kivy-PreInstalled is now using python 3.8 ... which is not supported by Kivy 1.11.1 and this is preventing the repl from running. I'm working on finding an alternative solution for polygott.

In the meantime, here is a Python3.8 repl (including a local copy of Kivy 2.0.0rc3) that can run the Kivy showcase Kivy-Showcase-Python38-PreInstalled

Backing up the wheels isn't necessary either if we use Kivy = "^2.0.0rc3" in pyproject.toml together with

[tool.poetry.dev-dependencies.Kivy]
url = "https://kivy.org/downloads/ci/linux/kivy/Kivy-2.0.0rc3-cp38-cp38-manylinux2010_x86_64.whl"

as seen here: Python38-Kivy-200rc3

Edited 2020-08-25

Update 2020-08-27: Polygott repls are unable to show graphics. Even a simple X application fails to work. Polygott Simple Xclock Test

Import other repls!
posted to Share by 21natzil

@21natzil Hmm. I'm also getting an error when I try to use it. Any advice?

Example: https://repl.it/@Saibot84/RIMPTest

Traceback (most recent call last): File "main.py", line 8, in <module> rimp.load_repl("21natzil", "Permissions") File "/opt/virtualenvs/python3/lib/python3.8/site-packages/rimp/__init__.py", line 21, in load_repl for file_path, contents in collect_files(name, project): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/rimp/fetcher.py", line 47, in collect_files repl_meta = get_details(name, project) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/rimp/fetcher.py", line 20, in get_details script = soup.find_next("script").string.split('\n')[1][26:] IndexError: list index out of range

Cactus URLs
posted to Share by CodingCactus

Very nice work!

How to correctly setup Kivy in a Repl.it
posted to Ask by Saibot84

Great question @Alt_Plus_F4 !

Here's an example of Pyglet running in a Polygott REPL.

By using a polygott repl, we can controlling the installation using a Makefile.

For for a faster time-to-interactive I have:

  • downloaded the wheels for pyglet and future
  • and after building the future package once, I moved the wheel file into the local directory
  • then listed the two wheel files in requirements.txt
  • and used pip3 install -r requirements.txt to install the packages from the local directory

I hope that helps.