Pylons / waitress

Waitress - A WSGI server for Python 3
https://docs.pylonsproject.org/projects/waitress/en/latest/
Other
1.44k stars 164 forks source link

Error: No such option --listen #414

Closed cirqleBio closed 1 year ago

cirqleBio commented 1 year ago

Hello I am using the following command to deploy my dash based web app.

waitress-serve --listen localhost:9999 webapp:server

It results in following error

Usage: waitress-serve [OPTIONS] COMMAND [ARGS]...
Try 'waitress-serve --help' for help.

Error: No such option: --listen

I am running waitress-serve on windows 11 pro. Any help would be appreciated.

kgaughan commented 1 year ago

It's because you omitted the = between the flag and the value. For historical reasons, waitress uses getopt, not argparse, and the former considers the = as part of the name of the flag. Do this instead:

waitress-serve --listen=localhost:9999 webapp:server
cirqleBio commented 1 year ago

The problem still exists for me on windows with the = sign.

(base) ~\myapp>waitress-serve --listen=localhost:9999 webapp:server

Usage: waitress-serve [OPTIONS] COMMAND [ARGS]...
Try 'waitress-serve --help' for help.

Error: No such option: --listen

The strange part is that the command works in my mac environment, and fails on win 11 pro only.

stevepiercy commented 1 year ago

Maybe Windows does not use localhost? Try this:

--listen=*:9999

Example from https://docs.pylonsproject.org/projects/waitress/en/stable/runner.html#invocation

cirqleBio commented 1 year ago

Did not help same error. I tested different options and the error is raised with many of them. For example:

myapp>waitress-serve --host=0.0.0.0 --port=9998 webapp:server

This comand results in the same type of error

Error: No such option: --host

I assume there has to be something wrong with my installation.

kgaughan commented 1 year ago

See this:

Usage: waitress-serve [OPTIONS] COMMAND [ARGS]...
Try 'waitress-serve --help' for help.

I think I know what's going on here: whatever command you think you're running, it's not actually this waitress-serve. The usage is completely incorrect. waitress-serve prints out the help if you get something wrong.

Could you run waitress-serve --help and share the output with us? That might give us more of a hint as to what's going wrong for you.

cirqleBio commented 1 year ago

Here is the output of the waitress-serve --help

>waitress-serve --help
Usage:

    waitress-serve [OPTS] MODULE:OBJECT

Standard options:

    --help
        Show this information.

    --call
        Call the given object to get the WSGI application.

    --host=ADDR
        Hostname or IP address on which to listen, default is '0.0.0.0',
        which means "all IP addresses on this host".

        Note: May not be used together with --listen

    --port=PORT
        TCP port on which to listen, default is '8080'

        Note: May not be used together with --listen

    --listen=ip:port
        Tell waitress to listen on an ip port combination.

        Example:

            --listen=127.0.0.1:8080
            --listen=[::1]:8080
            --listen=*:8080

        This option may be used multiple times to listen on multiple sockets.
        A wildcard for the hostname is also supported and will bind to both
        IPv4/IPv6 depending on whether they are enabled or disabled.

    --[no-]ipv4
        Toggle on/off IPv4 support.

        Example:

            --no-ipv4

        This will disable IPv4 socket support. This affects wildcard matching
        when generating the list of sockets.

    --[no-]ipv6
        Toggle on/off IPv6 support.

        Example:

            --no-ipv6

        This will turn on IPv6 socket support. This affects wildcard matching
        when generating a list of sockets.

    --unix-socket=PATH
        Path of Unix socket. If a socket path is specified, a Unix domain
        socket is made instead of the usual inet domain socket.

        Not available on Windows.

    --unix-socket-perms=PERMS
        Octal permissions to use for the Unix domain socket, default is
        '600'.

    --url-scheme=STR
        Default wsgi.url_scheme value, default is 'http'.

   --url-prefix=STR
        The ``SCRIPT_NAME`` WSGI environment value.  Setting this to anything
        except the empty string will cause the WSGI ``SCRIPT_NAME`` value to be
        the value passed minus any trailing slashes you add, and it will cause
        the ``PATH_INFO`` of any request which is prefixed with this value to
        be stripped of the prefix.  Default is the empty string.

    --ident=STR
        Server identity used in the 'Server' header in responses. Default
        is 'waitress'.

Tuning options:

    --threads=INT
        Number of threads used to process application logic, default is 4.

    --backlog=INT
        Connection backlog for the server. Default is 1024.

    --recv-bytes=INT
        Number of bytes to request when calling socket.recv(). Default is
        8192.

    --send-bytes=INT
        Number of bytes to send to socket.send(). Default is 18000.
        Multiples of 9000 should avoid partly-filled TCP packets.

    --outbuf-overflow=INT
        A temporary file should be created if the pending output is larger
        than this. Default is 1048576 (1MB).

    --outbuf-high-watermark=INT
        The app_iter will pause when pending output is larger than this value
        and will resume once enough data is written to the socket to fall below
        this threshold. Default is 16777216 (16MB).

    --inbuf-overflow=INT
        A temporary file should be created if the pending input is larger
        than this. Default is 524288 (512KB).

    --connection-limit=INT
        Stop creating new channels if too many are already active.
        Default is 100.

    --cleanup-interval=INT
        Minimum seconds between cleaning up inactive channels. Default
        is 30. See '--channel-timeout'.

    --channel-timeout=INT
        Maximum number of seconds to leave inactive connections open.
        Default is 120. 'Inactive' is defined as 'has received no data
        from the client and has sent no data to the client'.

    --[no-]log-socket-errors
        Toggle whether premature client disconnect tracebacks ought to be
        logged. On by default.

    --max-request-header-size=INT
        Maximum size of all request headers combined. Default is 262144
        (256KB).

    --max-request-body-size=INT
        Maximum size of request body. Default is 1073741824 (1GB).

    --[no-]expose-tracebacks
        Toggle whether to expose tracebacks of unhandled exceptions to the
        client. Off by default.

    --asyncore-loop-timeout=INT
        The timeout value in seconds passed to asyncore.loop(). Default is 1.

    --asyncore-use-poll
        The use_poll argument passed to ``asyncore.loop()``. Helps overcome
        open file descriptors limit. Default is False.

    --channel-request-lookahead=INT
        Allows channels to stay readable and buffer more requests up to the
        given maximum even if a request is already being processed. This allows
        detecting if a client closed the connection while its request is being
        processed. Default is 0.
kgaughan commented 1 year ago

You seem to have some kind of weird wrapper in place. There's nothing we can do about that.