So basically I want the .replit
run
to execute a file from another repl. How could I do that?
So basically I want something like this:
run = "python https://replit.com/@SnakeyKing/repl#main.py"
So basically I want the .replit
run
to execute a file from another repl. How could I do that?
So basically I want something like this:
run = "python https://replit.com/@SnakeyKing/repl#main.py"
Not really sure, but that would be a really cool idea! for rickrolls
At the moment, this is not possible.
You can expose a shell file from a webserver and execute that, but you can’t run a file in another Repl.
So basically like make a html/css/js project thing and have a random python file that you can access from the web?
hmm let me try that
So I made a repl and you can access main.py like this:
and I got this on a different repl
python3 https://pytest.doxr.repl.co/main.py
/home/runner/randomproj/venv/bin/python3: can’t open file ‘/home/runner/randomproj/https://pytest.doxr.repl.co/main.py’: [Errno 2] No such file or directory
I tried it with bash too (did it in shell) and it didn’t work
I probably did it wrong because both think that the link is a directory so idk
It could be a feature request
I’m gonna change this topic into a feature request
Wait… Can’t we just do:
run = "/home/runner/another-repl/main.py"
or
run = "../home/runner/another-repl/main.py"
???
No, unfortunately, I discovered that each Repl has it’s own file system, and even though the home directory is always in /home/runner
, they are never in the same Repl. In other words, each Repl’s directories are entirely different. If they weren’t, we wouldn’t need a replit.nix
config, since /nix/store
would be synced as well (which it clearly isn’t, since we need to install Nix packages for every Repl)
@doxr Yes, you did do it wrong.
Here’s how you do it:
main.py
, write:from requests import get
from os import system
r = get("https://pytest.doxr.repl.co/main.py")
r.raise_for_status()
r = r.text
system("touch file.py")
with open("file.py") as file:
file.write(r)
system("python3 file.py")
(Note: It is advisable to keep pytest.doxr.repl.co always on for this.)
I did the exact same thing, but instead of buying always-on I just shoved my scripts into a GitHub repository, and accessed it through a URL like https://raw.githubusercontent.com/[user]/[repo]/[branch_i_think]/path_to_file
This is not unfortunate. I have at least two corrupted Repls (and one of those two doesn’t even run). I am glad that they do not share a filesystem with my other Repls, because if they did all my Repls would be bricked.