Robyn icon indicating copy to clipboard operation
Robyn copied to clipboard

Robyn not running on OS X

Open amdescombes opened this issue 1 year ago • 6 comments

Bug Description

Hi everybody, First of all, congratulations on your great work. I'm trying to test Robyn on an OS X (Macbook pro M4 Pro, latest Sequoia OS X, Python3.11) environment in order to compare it to Sanic. I'm getting an invalid port error, sanic runs fine on the same port. Is there a known issue with OS X? Thanks in advance André

Steps to Reproduce

hello world program:

from robyn import Robyn

Create an instance of Robyn app

app = Robyn(file)

Define a basic route

@app.get("/") async def home(): return "Hello World!"

Start the Robyn server

if name == "main": app.start(port=8081)

Your operating system

MacOS

Your Python version (python --version)

3.11

Your Robyn version

latest

Additional Info

I'd be happy to do some testing

amdescombes avatar Oct 17 '24 08:10 amdescombes

Hey @amdescombes 👋

It does work for me. Could you send me the response of lsof -i tcp:8081 from your terminal?

sansyrox avatar Oct 17 '24 10:10 sansyrox

Hi @sansyrox, lsof -i tcp:8081 does not return anything and when I run a Sanic Hello World program on the same port it works fine! Thanks

amdescombes avatar Oct 17 '24 13:10 amdescombes

Here's the exception I get:

Traceback (most recent call last): File "/Users/amdescombes/Desktop/Desktop - Andre’s MacBook Pro/AMD/BinanceTest/testrobyn.py", line 13, in app.start(port=8081) File "/opt/homebrew/lib/python3.9/site-packages/robyn/init.py", line 257, in start while self.is_port_in_use(port): File "/opt/homebrew/lib/python3.9/site-packages/robyn/init.py", line 225, in is_port_in_use raise Exception(f"Invalid port number: {port}") Exception: Invalid port number: 8081

amdescombes avatar Oct 17 '24 13:10 amdescombes

Hey @amdescombes 👋

What command are you using to run the script?

sansyrox avatar Oct 17 '24 23:10 sansyrox

I'm running like so (I pass no arguments to it):

python3.11 testrobyn.py

amdescombes avatar Oct 18 '24 06:10 amdescombes

Are you running on an Intel or an Apple processor @sansyrox ? I tried running on Python3.9 and it didn't work either

amdescombes avatar Oct 18 '24 07:10 amdescombes

@amdescombes , I am running on an apple processor.

sansyrox avatar Oct 21 '24 18:10 sansyrox

@VishnuSanal , can you try once?

sansyrox avatar Oct 21 '24 18:10 sansyrox

@amdescombes , could you please share a github gist of the code?

sansyrox avatar Oct 21 '24 18:10 sansyrox

Hi @sansyrox here is the requested code:

from robyn import Robyn

app = Robyn(__file__)

@app.get("/")
async def home():
    return "Hello, Robyn!"

if __name__ == "__main__":
    app.start(port=8081)

amdescombes avatar Oct 22 '24 06:10 amdescombes

That is the code that doesn't work

amdescombes avatar Oct 23 '24 15:10 amdescombes

Hey @amdescombes 👋

I am unable to replicate the bug. Can you share your mac os version?

sansyrox avatar Oct 24 '24 20:10 sansyrox

Yes, I'm running on Macbook Pro M3 Max with Sequoia 15.0.1 (24A348)

amdescombes avatar Oct 25 '24 05:10 amdescombes

what's strange is that I can open the same port with CherryPy, Flask or Sanic with no problems

amdescombes avatar Oct 25 '24 06:10 amdescombes

@amdescombes , is port 8080 or 8082 working?

sansyrox avatar Oct 26 '24 18:10 sansyrox

Yessss

amdescombes avatar Oct 26 '24 19:10 amdescombes

Thanks, it must be something with 8081

amdescombes avatar Oct 26 '24 19:10 amdescombes

Alright, then. Closing.

sansyrox avatar Oct 26 '24 19:10 sansyrox