M
M
Max Payne2017-06-16 18:59:41
Python
Max Payne, 2017-06-16 18:59:41

Why does this error occur when accessed from apache?

I will immediately give a small part of the code to make it clear what is at stake:

code under the cut
#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys, os, json, cymysql, requests
from urllib.parse import parse_qs

from VKD_class import VKD as Maya

class cb(Maya):
    def __init__(self):
        self.post = json.loads(sys.stdin.read())
        self.get = parse_qs(os.getenv("QUERY_STRING"))
        self.type = self.post['type']
        self.group_id = str(self.post['group_id'])
        Maya.__init__(self, self.group_id, 3)
        try:
            self.secret = self.post['secret']
        except:
            self.secret = 'undefined'

    def start(self):
        return self.action(self.type)


With normal access from the python console, everything is in order
>>> from cb_class import cb
>>> cb().start()
>? {"type":"confirmation","group_id":105072332}
...

And when accessing from the WEB, in the Apache logs I see the following:
[Fri Jun 16 18:50:25.832423 2017] [cgi:error] [pid 7324] [client 87.240.173.169:37169] AH01215: Traceback (most recent call last):: /var/www/html/cb.py
[Fri Jun 16 18:50:25.832508 2017] [cgi:error] [pid 7324] [client 87.240.173.169:37169] AH01215:   File "/var/www/html/cb.py", line 7, in <module>: /var/www/html/cb.py
[Fri Jun 16 18:50:25.832516 2017] [cgi:error] [pid 7324] [client 87.240.173.169:37169] AH01215:     cb().start(): /var/www/html/cb.py
[Fri Jun 16 18:50:25.832532 2017] [cgi:error] [pid 7324] [client 87.240.173.169:37169] AH01215:   File "/home/madmonday/v2/cb_class.py", line 15, in __init__: /var/www/html/cb.py
[Fri Jun 16 18:50:25.832563 2017] [cgi:error] [pid 7324] [client 87.240.173.169:37169] AH01215:     Maya.__init__(self, self.group_id, 3): /var/www/html/cb.py
[Fri Jun 16 18:50:25.832585 2017] [cgi:error] [pid 7324] [client 87.240.173.169:37169] AH01215: TypeError: __init__() takes from 1 to 2 positional arguments but 3 were given: /var/www/html/cb.py

What is the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2017-06-16
@dimonchik2013

python2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question