我正在使用 python 3 运行以下代码并且工作正常:
#!/usr/bin/env python
from pysimplesoap.client import SoapClient
import time
import sys
def get_item(info, item):
item = [i[item] for i in info if item in i]
return item
ppx = sys.argv[1]
c = SoapClient(wsdl="http://%s/getwsdl.php" % ppx, soap_server="oracle")
pepe = c.getServiceOutFilters(idOut="0", serviceId="50", )["result"]
当我尝试 dockerize 它不起作用。我正在使用以下 Dockerfile:
FROM python:3.5.3
ENV PYTHONUNBUFFERED=1
# workdir
RUN mkdir /code
WORKDIR /code
# Install dependencies
RUN pip install --upgrade pip
COPY requirements.txt .
RUN pip install -r requirements.txt
# Copy project
COPY . .
COPY ./entrypoint.sh /
ENTRYPOINT ["sh", "/entrypoint.sh"]
入口点如下:
python3 CambiarPaquetePPX.py 10.23.0.20
reqirements.txt 如下:
PySimpleSOAP==1.16.2
当我运行容器时,出现以下错误:
web_1 | Traceback (most recent call last):
web_1 | File "CambiarPaquetePPX.py", line 30, in <module>
web_1 | pepe = c.getServiceOutFilters(idOut="0", serviceId="50", )["result"]
web_1 | File "/usr/local/lib/python3.5/site-packages/pysimplesoap/client.py", line 177, in <lambda>
web_1 | return lambda *args, **kwargs: self.wsdl_call(attr, *args, **kwargs)
web_1 | File "/usr/local/lib/python3.5/site-packages/pysimplesoap/client.py", line 351, in wsdl_call
web_1 | return self.wsdl_call_with_args(method, args, kwargs)
web_1 | File "/usr/local/lib/python3.5/site-packages/pysimplesoap/client.py", line 375, in wsdl_call_with_args
web_1 | response = self.call(method, *params)
web_1 | File "/usr/local/lib/python3.5/site-packages/pysimplesoap/client.py", line 258, in call
web_1 | jetty=self.__soap_server in ('jetty',))
web_1 | File "/usr/local/lib/python3.5/site-packages/pysimplesoap/simplexml.py", line 56, in __init__
web_1 | self.__document = xml.dom.minidom.parseString(text)
web_1 | File "/usr/local/lib/python3.5/xml/dom/minidom.py", line 1968, in parseString
web_1 | return expatbuilder.parseString(string)
web_1 | File "/usr/local/lib/python3.5/xml/dom/expatbuilder.py", line 925, in parseString
web_1 | return builder.parseString(string)
web_1 | File "/usr/local/lib/python3.5/xml/dom/expatbuilder.py", line 223, in parseString
web_1 | parser.Parse(string, True)
web_1 | xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 0
localcito2_web_1 exited with code 1
有谁会发生什么或如何解决它?