Apr-30-2021, 06:45 AM
I have a main class that returns the result of a secondary class. The problem is defined in the following message in the terminal:
TypeError: can only concatenate str (not "CompletedProcess") to str
This is due to the sub-process that I need to concatenate within the body of the html, below is an excerpt from the primary class and the secondary class:
Primary Class
TypeError: can only concatenate str (not "CompletedProcess") to str
This is due to the sub-process that I need to concatenate within the body of the html, below is an excerpt from the primary class and the secondary class:
Primary Class
def do_GET(self): self.do_HEAD() from index import Index o_html = Index().view() self.wfile.write(bytes(o_html, "utf8")) returnSecondary Class
#! /usr/local/bin/python3.9 import subprocess # Class name : Index -> Structure html page : class Index: # Class method : Constructor -> Object Build : def __init__(self): pass # Class method : build -> : Render code html : def view(self): self.v_shell = subprocess.run("ls") # Variable : v_html5 -> Code Html self.v_html5 = """ <!DOCTYPE html> <html lang="pt-BR"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Webstrucs Action</title> </head> <body> <h1>Action</h1> Python Web Server For Asynchronous Requests<br> """ + self.v_shell + """ <p> </p> </body> </html> """ return self.v_html5How can I get around this TypeError?