#๐ i cant run my python file fastAPI
114 messages ยท Page 1 of 1 (latest)
@cerulean lintel
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
thats not a python error i dont think
im trying to learn fastAPI
try doing the same request with curl or the windows equivilant
i dont think anything is at :8080
i cant run my python file fastAPI
what should i do
run the server at port 8080
how do i do that
\:
127.0.0.1 is your machine
if you are following a guide, it probably wants you to run something on your machine
im following a youtube tutorial
gimme
ok
Unlock the power of Python APIs with our step-by-step tutorial on FastAPI and OpenAI's ChatGPT. FastAPI is a high-performance web framework that's perfect for building APIs, and ChatGPT brings a layer of artificial intelligence into the mix.
AI Demos: https://www.aidemos.com/
AIDemos.com is your go-to directory for video demos of the latest AI...
im on 13:31
ok thanks
https://youtu.be/KVdP4SpWcc4?t=32 (timestamped)
you need to install all this stuff
i recommend using a venv
i did but i opened a new terminal maybe this is the problem
do pip list
PS C:\Users\Layan\OneDrive\Desktop\ChatBot\app> pip list
Package Version
annotated-types 0.7.0
anyio 4.8.0
certifi 2025.1.31
charset-normalizer 3.4.1
click 8.1.8
colorama 0.4.6
distro 1.9.0
fastapi 0.115.8
h11 0.14.0
httpcore 1.0.7
httpx 0.28.1
idna 3.10
jiter 0.8.2
openai 1.61.0
pip 25.0
pydantic 2.10.6
pydantic_core 2.27.2
requests 2.32.3
sniffio 1.3.1
starlette 0.45.3
tqdm 4.67.1
typing_extensions 4.12.2
urllib3 2.3.0
uvicorn 0.34.0
that looks right, ill keep watching :)
have you got this running in the background
(this one has chosen port 8000 not 8080)
yes
does it say port 8080
replace line 5 with
@app.post("/chatbot-response")
things ending in a / are a directory
ok
idk if it makes a difference, try it
i did
connection refused suggests that it cant reach the server
you sure its runningon 8080
how do i know
yes i did this step before and it was running
keep watching till he makes a new file called request
and run on a new terminal
on port 8080?
i forgot
how do i do that
do i have to change main to request?
im gonna tentativly answer no to that
im not sure what you mean
you have "main" (?) which is the fastapi server (?)
and "request" (?) which does a request to it
bc i have another file called request which im trying to run but its ok i did it on both and the server working
but on my other terminal which im trying to do python request on. the terminal is stuck it looks like this
i cant write on it
i tried control c
didnt work
you can close on the right tab
idk if that kills the process, you might have to use taskmgr
is this u rerunning it, or it finaly crashing out
i closed that terminal and opened a new one and typed python request
and got this
u want a screenshot?
the files
u tried running python request?
what i did:
1. put main.py and request.py in a folder
2. python -m venv .venv
3. activate venv
4. pip install fastapi uvicorn requests
5. uvicorn main:app --reload
6. new terminal
7. activate venv
8. python request
9. {'detail': [{'type': 'missing', 'loc': ['query', 'user_message'], 'msg': 'Field required', 'input': None}]}
an error message still but it gave me something
ill cancel my terminals and try do ur steps and let u know
you can try netstat -an | find "8000" (in cmd) to see if the server has actually bound itself to 8000
when should i try it
after youve run the server and it says "runnin on port 8000"
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.