Tag:

TypeError:'NoneType'对象不可调用+使用docker image

我在python中使用pydoc定位dynamic加载类。 当我从eclipse运行项目时,类加载成功。 示例代码如下所示 from pydoc import locate my_class = locate('my_package.my_module.MyClass') my_instance =my_class() 现在,我创build了一个Dockerfile,并且Docker构build成功。 当我运行docker镜像时,类不会被加载,实例也不会被创build。 它显示这个错误 TypeError:'NoneType'对象不可调用

Docker镜像在CentOS中失败,但在MacOS上工作

我正在使用下面的Dockerfile: FROM centos RUN yum -y -q install epel-release && yum -y -q update && yum clean all \ && yum -y -q install python-pip COPY requirements.txt /tmp/ RUN pip install -q pyvmomi==6.5.0.2017.5.post1 不知道为什么它使用17.09.0-ce在MacOS上正常工作,但是没有使用CentOS和17.11.0-ce-rc3 。 在pip安装中有一个错误,在这个例子中我使用了pyvmomi但是我和其他软件包有类似的错误。 Step 3/3 : RUN pip install pyvmomi==6.5.0.2017.5.post1 —> Running in 49d94b300e7f Collecting pyvmomi==6.5.0.2017.5.post1 Downloading pyvmomi-6.5.0.2017.5-1.tar.gz (252kB) Collecting requests>=2.3.0 (from […]

Tensorflow Inception V3培训错误

我试图通过在Docker上重新训练Inception V3来创build肿瘤图像分类器。 当我运行Python脚本时,我的class级子文件夹中的图像未被检测到。 所有的图像都是PNG格式。 这是代码和错误: root@c47d0d562199:/classifier# python retrain.py bottlenecks_dir=bottlenecks –how_many_steps=4000 –model_dir=inception –summaries_dir=training_summaries/long –output_graph=retrained_graph.pb –output_labels=retrained_labels.txt –image_dir=Images 2017-11-16 21:26:20.099812: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2017-11-16 21:26:20.099898: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but […]

编辑泊坞窗容器中的文件

我有一个ZIP文件,我将在泊坞窗容器内进行操作。 def modify_zip_file(): zip_file = zipfile.ZipFile(main_zipfile, "r") zip_file.extractall(course_file_location) —Make some changes to some files in the extracted directory —Re-zip the directory zip_file.close() 以下是我的docker-compose.yaml的内容 www: build: ./www image: course_gen_ui:latest ports: – "80:80" links: – db depends_on: – db volumes: – ./host_dir:/container_dir 对“extractall”的调用会提取容器内的所有内容,但是我无法在容器之外的<host_dir>看到这些提取的内容。 任何帮助,将不胜感激。

Python烧瓶docker化的Web应用程序api不返回响应错误:BrokenFilesystemWarning

我正在使用python 2.7和烧瓶,返回我的本地设置的完整响应。 现在应用程序被docker化并部署在Google kubernetes容器中。 这是POST方法的一个示例API,它将input作为application / jsoninput,当前内部函数能够以JSON格式获取数据,但不返回到客户端。 Python部分: from flask import Flask, render_template, request, jsonify from flask_cors import CORS, cross_origin import sys from runmodel import run reload(sys) # Reload is a hack sys.setdefaultencoding('UTF8') app = Flask(__name__, static_url_path='/static') CORS(app) @app.route("/modelrun", methods=['POST']) def modelrun(): """TO run the model and get data to populate""" req_data = request.json res […]

如何使用Docker SDK for Python导出Docker容器?

在撰写本文时,文件说: 出口() 将容器文件系统的内容导出为tar存档。 返回:文件系统tar归档文件 返回types:(str) 引发:docker.errors.APIError – 如果服务器返回错误。 我试图做一个容器实例做container.export() ,它似乎是做某事,然后不报告任何错误,但不返回任何string。 所以我不知道这个出口是否有效以及它去了哪里。 通过查看本地目录,我看不到任何新文件。 我也想给一个文件path作为参数,就像真正的docker导出,但据我所知,这是不可能的。 你有没有工作的例子?

Docker教程是什么意思“抓住一个可移植的Python运行时作为一个图像”?

我正在用Python应用程序开始Docker教程,并想知道在这种情况下“Python运行时”的含义: 在过去,如果你要开始编写一个Python应用程序,你的第一步就是在你的机器上安装一个Python运行库。 但是,这会造成您的机器上的环境必须如此以使您的应用程序按预期运行。 同上运行你的应用程序的服务器。 使用Docker,你可以将一个可移植的Python运行库作为一个映像,不需要安装。 然后,您的构build可以将基础Python图像与应用程序代码一起包括在内,确保您的应用程序,依赖项和运行时都一起旅行。 所以我想这是什么意思是“Python运行时”就像你的本地Python的configuration。

Docker-compose SystaxError:parsing时意外的EOF

我试图通过下面这个简单的例子来学习Docker-compose,但是在我添加“volumes:。:/ code:到我的SystaxError: unexpected EOF while parsing -compose文件中,我得到了一个SystaxError: unexpected EOF while parsing 。不要加卷,我错过了什么吗?谢谢! 编辑:这是我的docker组成文件 version: '3' services: web: build: . ports: – "5000:5000" volumes: – .:/code redis: image: "redis:alpine"

错误:无法findRequirement.parse('supervisor')的合适分配

我正在使用Dockerfile构builddocker镜像。 但由于以下错误而失败: Removing intermediate container 20496108c6dd Step 5/27 : RUN sudo easy_install supervisor —> Running in 7a504c86e985 Searching for supervisor Reading http://pypi.python.org/simple/supervisor/ Couldn't find index page for 'supervisor' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading http://pypi.python.org/simple/ No local packages or download links found for supervisor error: Could not find […]

在远程主机上使用pycharm在Docker容器中进行debugging

我在我的Windows计算机上使用pycharm 2017.2,我正在远程linux服务器上运行我的docker容器,我想知道是否有方法来debugging我的Python代码使用泊坞站容器内的本地pycharm gui。 (我看到,如果docker工人在本地运行是可能的…) 当我尝试在unix套接字之前放入主机的IP时,出现错误 “无法连接java.io.IOException通道已断开连接” 提前致谢