python with docker async def SyntaxError: invalid syntax

python with docker async def SyntaxError: invalid syntax

I have python app in virtualenv that leverage async function calls

I have python app in virtualenv that leverage async function calls

Recently I tried moving my app to docker container, with following Dockerfile:

FROM python:3.7
ENV PYTHONUNBUFFERED 1
ADD . /code
WORKDIR /code

RUN pip install -r requirements.txt

CMD ["python3", "app.py"]

docker-compose.yml:

version: '3'
services:
  app:
    build: .
    volumes:
      - .:/code
    ports:
     - "8080:80"

unfortunately, when trying to run my container with docker-compose up I get following error:

    Starting app_1 ... done
Attaching to app_1
app_1  |   File "app.py", line 31
app_1  |     async def handle_DATA(self, server, session, envelope):
app_1  |             ^
app_1  | SyntaxError: invalid syntax
app_1 exited with code 1

What might be cause of this? As far as I know, from python 3.5 async is built-in in stdlib

python docker

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Docker Explained: Docker Architecture | Docker Registries

Following the second video about Docker basics, in this video, I explain Docker architecture and explain the different building blocks of the docker engine; docker client, API, Docker Daemon. I also explain what a docker registry is and I finish the video with a demo explaining and illustrating how to use Docker hub.

Basic Data Types in Python | Python Web Development For Beginners

In the programming world, Data types play an important role. Each Variable is stored in different data types and responsible for various functions. Python had two different objects, and They are mutable and immutable objects.

How To Compare Tesla and Ford Company By Using Magic Methods in Python

Magic Methods are the special methods which gives us the ability to access built in syntactical features such as ‘<’, ‘>’, ‘==’, ‘+’ etc.. You must have worked with such methods without knowing them to be as magic methods. Magic methods can be identified with their names which start with __ and ends with __ like __init__, __call__, __str__ etc. These methods are also called Dunder Methods, because of their name starting and ending with Double Underscore (Dunder).

Live: Python - Docker e Docker Compose - Projeto Flask extensions

Neste episódio colocamos o serviço #python para rodar com #Docker e Docker compose e o próximo passo será a #api Multistreaming with https://restream.io/?ref...

Python Programming: A Beginner’s Guide

Python is an interpreted, high-level, powerful general-purpose programming language. You may ask, Python’s a snake right? and Why is this programming language named after it?