Skip to content
Community
#help
14
RESOURCES
TheDrone7
Welcome to Replit Community [+ Rules]
TheDrone7
EVENTS
TOP TAGS
#games
93
#apps
23
#python
24.7K
#javascript
8.9K
#html
8.4K
#fun
4.1K
#game
3.6K
#simple
3.3K
#python3
2.6K
#java
2K
#cpp
1.8K
#bash
1.1K
ColoredHue
ColoredHue
published a Post
3 months ago
28
A Funny RPG Game [ALPHA TESTING]
A Funny RPG Game [ALPHA TESTING]A Funny RPG Game WIP Updates -~-~-~-~ 2.0 - Added Home 2.1- Added Yoyo and Apron [Atk and Hp] -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- `
I'm running into a circular import error, but I need to import a variable [FIXED]
I fixed this, now this comment is just a suggestion dump.
ColoredHue
ColoredHue nvm, after I looked more into it, it doesn't seem to be able to read just a variable of a page, only the whole entire page. Which is good if you have a large amount of text you need to print but not for getting data3 months ago
MrVoo
MrVoo @ColoredHue mmmmm ok, but what I was thinking was more of a main.py with something like this: ```py read_a_file() read_another_file() write_new_file( fileOneContent + fileTwoContent ) exec('import newlyCreatedFile') ```3 months ago
ColoredHue
ColoredHue @MrVoo hmmm, I'll need to test that out to see if it works3 months ago
#ask
#help
#python
+2
TomBroad
TomBroad
published a Post
3 weeks ago
Testing // Home
Replit keeps dying.
It will get to a certain line then die! Can anyone help?! image
TomBroad
TomBroad @MrVoo I’m still confused, could you write the correct code but for me, just that but so I can put it into the actual project?3 weeks ago
MrVoo
MrVoo @TomBroad Instead of break, you could just use `guesses = 0` if it really won't work3 weeks ago
TomBroad
TomBroad @MrVoo As I said I’m completely new, could you just give me the bit of code! I don’t know how to do it and I’ve been really struggling.3 weeks ago
GhostPandaX
GhostPandaX
published a Post
2 months ago
5
platformer
platformerPlatformer
why is this showing an error?
help please. This is really confusing and I'm unable to fix this.
hankertrix
hankertrix
published a Post
3 months ago
How do I make the run button call a function when the script is done running?
The repl here shows how the green run button in replit fails to call the exitcallback function which prints "Goodbye". However, when running the file using bash, using python3 main.py the exitcallback function is correctly called. You can try it by using runshell() in the console. Also, no, I can't use the runshell() function in place of the main() function, the repl will just fail to run properly. Is there any way to configure the run button so that the exit_callback function is called when the script exits? Or is this a bug I should report?
hankertrix
hankertrix @Highwayman I tinkered with the args and it seems that I can't remove any of the args without the repl process crashing. However, removing all the code related to the interpreter seems to have fixed the issue. I'm guessing it's because of using replit's prybar interface that causes Python to not register any exit handlers, since running it using a normal bash shell seems to work fine. I'm guessing most non-nix repls will use the prybar interface by default unless you configure the run button otherwise in the `.replit` file. Thank you so much for your help! I think this should be reported as a bug for prybar.2 months ago
Highwayman
Highwayman @hankertrix I'm glad to be of assistance :P There is a [feedback form](http://replit.com/support) for replit when you get bugs - thats probably the best place to post it. I've contacted them before I'm pretty sure and they're pretty responsive. :)2 months ago
hankertrix
hankertrix @Highwayman Thanks for the link! I'll send them a bug report in a bit.2 months ago
MuffinsTheCat
MuffinsTheCat
published a Post
2 months ago
[UNRELEASED] Talrythia
[UNRELEASED] TalrythiaAn upcoming RPG I am making
What is wrong with this?
Even if the main file is completely empty, no matter what I do, I get this error. It's not helpful at all as I do not have any of the files it lists but still it shows the error anyway. How do I fix this?
hankertrix
hankertrix @MuffinsTheCat which error are you encountering? Is it this one: ``` Traceback (most recent call last): File "main.py", line 6, in <module> if x == os.environ['devpass']: pass File "/nix/store/p21fdyxqb3yqflpim7g8s1mymgpnqiv7-python3-3.8.12/lib/python3.8/os.py", line 675, in __getitem__ raise KeyError(key) from None KeyError: 'devpass' ``` or this one: ``` Traceback (most recent call last): File "/tmp/upm4279124174/bare-imports.py", line 13, in <module> imports, had_errors = pipreqs.get_all_imports( File "/tmp/upm4279124174/pipreqs.py", line 52, in get_all_imports contents = f.read() File "/nix/store/2vm88xw7513h9pyjyafw32cps51b0ia1-python3-3.8.12/lib/python3.8/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte exit status 1 Replit: Package operation failed. ``` For the former, add a secret in the secrets tab with key "devpass" with whatever value you desire. For the latter, press the triple dots beside the button to add a folder and click show hidden files. Click on the `.replit` and scroll all the way to the bottom. You should see this: ``` # Configures the packager. [packager] # Search packages in PyPI. language = "python3" # Never attempt to install `unit_tests`. If there are packages that are being # guessed wrongly, add them here. ignoredPackages = ["unit_tests"] [packager.features] enabledForHosting = false # Enable searching packages from the sidebar. packageSearch = true # Enable guessing what packages are needed from the code. guessImports = true ``` Change the guessImports variable to false, like this: ``` # Configures the packager. [packager] # Search packages in PyPI. language = "python3" # Never attempt to install `unit_tests`. If there are packages that are being # guessed wrongly, add them here. ignoredPackages = ["unit_tests"] [packager.features] enabledForHosting = false # Enable searching packages from the sidebar. packageSearch = true # Enable guessing what packages are needed from the code. guessImports = false ``` That should fix both of your issues. If you want more information on the latter issue, read on. Otherwise, you can just ignore this part. The latter issue is due to the packager in replit trying to guess your imports. The Universal Package Manager (UPM) in replit will walk through all your Python (.py) files to find where you used the word import and then try to find the package you imported and install it using pip. However, since your `savedata.py` file is actually a save file that contains a serialised Python object instead of a regular Python text file that contains regular text, the UPM fails to read your `savedata.py` file using the UTF-8 encoding and hence throws a UnicodeDecodeError since the serialised Python object in `savedata.py` cannot be decoded using UTF-8. You should be able to see Pyflakes complaining about being unable to decode the bytes when you navigate to the `savedata.py` file to edit it. Another way to fix this error would be to simply change your file extension of the savedata file to something else, like `.sav` for example. But since you're not using any external packages, I recommend just not allowing the UPM to guess imports since there may be a lot of things to change in your existing code if you need to change the file extension of the savedata file. 2 months ago
MuffinsTheCat
MuffinsTheCat @hankertrix Yes, thank you. I finally know what was wrong with the code. Just need to change it to a different file extenstion. The first error shouldn't happen but I'll make sure the secret is there2 months ago
hankertrix
hankertrix @MuffinsTheCat You're welcome!2 months ago
ClareLu
ClareLu
published a Repl
2 days ago
Python pandas errors - csv file
Python pandas errors - csv filei'm getting tons of error messages just importing the csv file. Dataframe seems empty, object can't find attribute etc. Help please?
sprowberry8
sprowberry8 Man, those are some Python errors!2 days ago
zarooma
zarooma
published a Post
4 weeks ago
why replit being so laggy
iv been using replit for and it was never this bad most of my project wont load and i deleted a lot of them
MRHACKER370
MRHACKER370 @zarooma Could Just Be The Replit Servers, They Can Be Really Laggy For A While3 weeks ago
zarooma
zarooma @MRHACKER370 THX3 weeks ago
mackendeleon
mackendeleon
published a Post
2 months ago
HELP
I have been using repl for school for programming 1 but whenever I use quotation marks they dont do what theyre supposed to, they come up as an error and an invalid synntax. I need help so I canpass this class
MagnusSee
MagnusSee @mackendeleon Replace the quotation marks with ' and look at this: print('your profit is: $' + str(profit))2 months ago
6w6
6w6 @mackendeleon your program uses the ¨ character for quotes for some reason, you may need to change your keyboard settings because its supposed to be "2 months ago
NerminDedic
NerminDedic
published a Repl
2 months ago
NerminDedic
NerminDedic I don't understand these 10 failed tests2 months ago
LegoLiam
LegoLiam
published a Post
3 months ago
Munchlax gif dont work
please tell me how to insert a gif on turtle
PizzaMan21
PizzaMan21
published a Post
3 months ago
Java Project Help
Hello! I'm currently working on a project. This is what the program should do: greet the player and ask him or her to play the game declare and initialize variables for the loop counter and the player's choice use System.read.in() to accept the player's guess create and output messages if the player's guess is wrong, and when the guess is correct The program should continue untill the player guesses the answer correctly. It doesn't matter which loop it is, but it has to be either a for loop, do-while loop, or the while loop. Please help me! Thank you! I can send you an invite so you can edit the program.
eliasciur
eliasciur @PizzaMan21 Hey, can you send me the invite so I can check the code out?2 months ago
Bunnytoes
Bunnytoes
published a Post
3 months ago
Shutdown
I have some java code and I want to do the same thing in JavaScript and I tried to use Java.Type(applets are no longer used) of for the Runtime but that didn't work and I also tried the javascript exec(custom class) and that also didn't work I will leave the java code and what I have so far down below import java.io.IOException; public class ShutDown { public static void main(String[] args) throws IOException { shutdown(); } public static void shutdown() throws RuntimeException, IOException { String shutdownCommand; String operatingSystem = System.getProperty("os.name"); if (operatingSystem.startsWith("Linux") || operatingSystem.startsWith("Mac")) { shutdownCommand = "shutdown -h now"; } else if (operatingSystem.startsWith("Windows")) { shutdownCommand = "shutdown.exe -s -t 0"; } else if (operatingSystem.startsWith("Chrome")) { shutdownCommand = "taskkill /F /IM chrome.exe /T"; } else { throw new RuntimeException("Unsupported operating system."); } Runtime.getRuntime().exec(shutdownCommand); System.exit(0); } } var Runtime = Java.type("java.lang.Runtime"); if (navigator.appVersion.indexOf("Win") != -1) { Runtime.getRuntime().exec("shutdown.exe -s -t 0"); } if (navigator.appVersion.indexOf("Mac") != -1) { Runtime.getRuntime().exec("shutdown -h now"); } if (navigator.appVersion.indexOf("Linux") != -1){ Runtime.getRuntime().exec("shutdown -h now"); } if (navigator.appVersion.indexOf("Chrome") != -1){ Runtime.getRuntime().exec("taskkill /F /IM chrome.exe /T"); } two more questions, can you please try to help make this work as a bookmarklet, and this works in intellij, but I don't know if browser JS can access home files. also unrealted but if I can get help changing tje volume with browser JS also Thanks
JericJanJan
JericJanJan
published a Post
3 months ago
Did ffmpeg get removed from /usr/bin?
Ignore the repl. For as long as I can remember, any repo that I create always had ffmpeg inside /usr/bin. Now there isn't. I have to go through this nix thing that I somehow never encountered before. screenshot The strangest part is I have an older repl that still has ffmpeg inside /usr/bin and it never gets deleted or anything in the countless resets it's had. Guess I should just do it the nix way, which is a little annoying. If anyone else is stuck with the same issue I had, I added a replit.nix file in the root folder (Remember to enable "Show hidden files"). Inside that file, I typed in: { pkgs }: { deps = [ pkgs.ffmpeg.bin ]; } `
9pfs
9pfs @JericJanJan That's strange. Still, the Nix thing is nice because you can have over a terabyte of dependencies with no issues.3 months ago
Load more