So, I use code that can for some reason only be run in console using the command: 'python ./Ghost.py', and when I put that in the .replit file as the run command, it turns on and back off immediately. I want to know how to make the 'Run' button work, and what I need to put in the .replit file to do it. It used to work for some time, and then I updated the code and now it doesn't...
How can I made the Run button in Replit work on this sequence?
597 views Asked by Shkeffy At
3
There are 3 answers
0
On
make sure to show hidden files by clicking the 3 dots on the right of the create folder button then copy the following configs for each file
the .replit config for python3 :
run = "python3 main.py"
# The primary language of the repl. There can be others, though!
language = "python3"
entrypoint = "main.py"
# A list of globs that specify which files and directories should
# be hidden in the workspace.
hidden = ["venv", ".config", "**/__pycache__", "**/.mypy_cache", "**/*.pyc"]
modules = ["pyright-extended:v1-20230707-0c33b22"]
# Specifies which nix channel to use when building the environment.
[nix]
channel = "stable-22_11"
# The command to start the interpreter.
[interpreter]
[interpreter.command]
args = [
"stderred",
"--",
"prybar-python310",
"-q",
"--ps1",
"\u0001\u001b[33m\u0002\u0001\u001b[00m\u0002 ",
"-i",
]
env = { LD_LIBRARY_PATH = "$PYTHON_LD_LIBRARY_PATH" }
[env]
VIRTUAL_ENV = "${REPL_HOME}/venv"
PATH = "${VIRTUAL_ENV}/bin"
PYTHONPATH = "$PYTHONHOME/lib/python3.10:${VIRTUAL_ENV}/lib/python3.10/site-packages"
REPLIT_POETRY_PYPI_REPOSITORY = "https://package-proxy.replit.com/pypi/"
MPLBACKEND = "TkAgg"
POETRY_CACHE_DIR = "${REPL_HOME}/.cache/pypoetry"
# Enable unit tests. This is only supported for a few languages.
[unitTest]
language = "python3"
# Add a debugger!
[debugger]
support = true
# How to start the debugger.
[debugger.interactive]
transport = "localhost:0"
startCommand = ["dap-python", "main.py"]
# How to communicate with the debugger.
[debugger.interactive.integratedAdapter]
dapTcpAddress = "localhost:0"
# How to tell the debugger to start a debugging session.
[debugger.interactive.initializeMessage]
command = "initialize"
type = "request"
[debugger.interactive.initializeMessage.arguments]
adapterID = "debugpy"
clientID = "replit"
clientName = "replit.com"
columnsStartAt1 = true
linesStartAt1 = true
locale = "en-us"
pathFormat = "path"
supportsInvalidatedEvent = true
supportsProgressReporting = true
supportsRunInTerminalRequest = true
supportsVariablePaging = true
supportsVariableType = true
# How to tell the debugger to start the debuggee application.
[debugger.interactive.launchMessage]
command = "attach"
type = "request"
[debugger.interactive.launchMessage.arguments]
logging = {}
# Configures the packager.
[packager]
language = "python3"
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
# These are the files that need to be preserved when this
# language template is used as the base language template
# for Python repos imported from GitHub
[gitHubImport]
requiredFiles = [".replit", "replit.nix", ".config", "venv"]
[deployment]
run = ["sh", "-c", "python3 main.py"]
the replix.nix config for python3 :
{ pkgs }: {
deps = [
pkgs.python310Full
pkgs.replitPackages.prybar-python310
pkgs.replitPackages.stderred
];
env = {
PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
# Needed for pandas / numpy
pkgs.stdenv.cc.cc.lib
pkgs.zlib
# Needed for pygame
pkgs.glib
# Needed for matplotlib
pkgs.xorg.libX11
];
PYTHONHOME = "${pkgs.python310Full}";
PYTHONBIN = "${pkgs.python310Full}/bin/python3.10";
LANG = "en_US.UTF-8";
STDERREDBIN = "${pkgs.replitPackages.stderred}/bin/stderred";
PRYBAR_PYTHON_BIN = "${pkgs.replitPackages.prybar-python310}/bin/prybar-python310";
};
}
Apparently if you use debugger, it works lol.