问题:

我有一个目录apkmirror-scraper-compose ,结构如下:

.
├── docker-compose.yml
├── privoxy
│   ├── config
│   └── Dockerfile
├── scraper
│   ├── Dockerfile
│   ├── newnym.py
│   └── requirements.txt
└── tor
    └── Dockerfile

我正在尝试运行以下docker-compose.yml :

version: '3'

services:
  privoxy:
    build: ./privoxy
    ports:
      - "8118:8118"
    links:
      - tor

  tor:
    build:
      context: ./tor
      args:
        password: ""
    ports:
      - "9050:9050"
      - "9051:9051"

  scraper:
    build: ./scraper
    links:
      - tor
      - privoxy

torDockerfile是哪里的

FROM alpine:latest
EXPOSE 9050 9051
ARG password
RUN apk --update add tor
RUN echo "ControlPort 9051" >> /etc/tor/torrc
RUN echo "HashedControlPassword $(tor --quiet --hash-password $password)" >> /etc/tor/torrc
CMD ["tor"]

对于privoxy

FROM alpine:latest
EXPOSE 8118
RUN apk --update add privoxy
COPY config /etc/privoxy/config
CMD ["privoxy", "--no-daemon"]

其中config由两行组成

listen-address 0.0.0.0:8118
forward-socks5 / tor:9050 .

scraperDockerfile

FROM python:2.7-alpine
ADD . /scraper
WORKDIR /scraper
RUN pip install -r requirements.txt
CMD ["python", "newnym.py"]

其中requirements.txt包含单行requests 最后,程序newnym.py旨在简单地测试使用Tor更改IP地址是否正常工作:

from time import sleep, time

import requests as req
import telnetlib


def get_ip():
    IPECHO_ENDPOINT = 'http://ipecho.net/plain'
    HTTP_PROXY = 'http://privoxy:8118'
    return req.get(IPECHO_ENDPOINT, proxies={'http': HTTP_PROXY}).text


def request_ip_change():
    tn = telnetlib.Telnet('tor', 9051)
    tn.read_until("Escape character is '^]'.", 2)
    tn.write('AUTHENTICATE ""\r\n')
    tn.read_until("250 OK", 2)
    tn.write("signal NEWNYM\r\n")
    tn.read_until("250 OK", 2)
    tn.write("quit\r\n")
    tn.close()


if __name__ == '__main__':
    dts = []
    try:
        while True:
            ip = get_ip()
            t0 = time()
            request_ip_change()
            while True:
                new_ip = get_ip()
                if new_ip == ip:
                    sleep(1)
                else:
                    break
            dt = time() - t0
            dts.append(dt)
            print("{} -> {} in ~{}s".format(ip, new_ip, int(dt)))
    except KeyboardInterrupt:
        print("Stopping...")
        print("Average: {}".format(sum(dts) / len(dts)))

docker-compose build构建成功,但是如果我尝试使用docker-compose up ,我会收到以下错误消息:

Creating network "apkmirrorscrapercompose_default" with the default driver
ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

我尝试在此错误消息上搜索帮助,但找不到任何帮助。 导致此错误的原因是什么?

I have a directory apkmirror-scraper-compose with the following structure:I’m trying to run the following docker-compose.yml :where the Dockerfile for tor isthat for privoxy iswhere config consists of the two linesand the Dockerfile for scraper iswhere requirements.txt contains the single line requests .Finally, the program newnym.py is designed to simply test whether changing the IP address using Tor is working:The docker-compose build builds successfully, but if I try docker-compose up , I get the following error message:I tried searching for help on this error message, but couldn’t find any.What is causing this error?

问题:

遵循这个Django by example tutotrial: http ://lightbird.net/dbe/todo_list.html

教程说:

“这改变了我们的表格布局,我们必须要求Django重置并重新创建表格:

manage.py reset todo; manage.py syncdb manage.py reset todo; manage.py syncdb

但是,当我运行manage.py reset todo ,我收到错误:

$ python manage.py reset todo                                       
- Unknown command: 'reset'

这是因为我使用的是sqlite3而不是postgresql吗?

有人能告诉我重置数据库的命令是什么吗?

命令: python manage.py sqlclear todo返回错误:

$ python manage.py sqlclear todo    
CommandError: App with label todo could not be found.    
Are you sure your INSTALLED_APPS setting is correct?

所以我在settings.py中将’todo’添加到我的INSTALLED_APPS中,并再次运行python manage.py sqlclear todo ,导致此错误:

$ python manage.py sqlclear todo                                      
- NameError: name 'admin' is not defined

Following this Django by Example tutotrial here: http://lightbird.net/dbe/todo_list.htmlThe tutorial says:”This changes our table layout and we’ll have to ask Django to reset and recreate tables:manage.py reset todo; manage.py syncdb “though, when I run manage.py reset todo , I get the error:Is this because I am using sqlite3 and not postgresql?Can somebody tell me what the command is to reset the database?The command: python manage.py sqlclear todo returns the error:So I added ‘todo’ to my INSTALLED_APPS in settings.py, and ran python manage.py sqlclear todo again, resulting in this error:

问题:

好的,这是什么,为什么它会在Win2003服务器上出现,但在WinXP上却不会出现。

它似乎根本不影响我的应用程序,但是当我关闭应用程序时收到此错误消息。 而且很烦人(因为错误消息应该如此)。

我正在使用pyOpenGl和wxPython做图形工作。 不幸的是,我是一位接管了此Python应用程序的C#程序员,我必须学习Python才能做到这一点。

我可以提供代码和版本号等,但我仍在学习技术知识,因此将不胜感激。

Python 2.5,wxPython和pyOpenGL

Okay, what is it, and why does it occur on Win2003 server, but not on WinXP.It doesn’t seem to affect my application at all, but I get this error message when I close the application.And it’s annoying (as errors messages should be).I am using pyOpenGl and wxPython to do the graphics stuff.Unfortunately, I’m a C# programmer that has taken over this Python app, and I had to learn Python to do it.I can supply code and version numbers etc, but I’m still learning the technical stuff, so any help would be appreciated.Python 2.5, wxPython and pyOpenGL

问题:

按照此处找到的教程,我无法创建自定义500或404错误页面。 如果我输入了错误的网址,该页面会为我提供默认的错误页面。 有什么我应该检查,以防止自定义页面显示?

文件目录:

mysite/
    mysite/
        __init__.py
        __init__.pyc
        settings.py
        settings.pyc
        urls.py
        urls.pyc
        wsgi.py
        wsgi.pyc
    polls/
        templates/
            admin/
                base_site.html
            404.html
            500.html
            polls/
                detail.html
                index.html
        __init__.py
        __init__.pyc
        admin.py
        admin.pyc
        models.py
        models.pyc
        tests.py
        urls.py
        urls.pyc
        view.py
        views.pyc
    templates/
    manage.py

在mysite / settings.py中我启用了这些:

DEBUG = False
TEMPLATE_DEBUG = DEBUG

#....

TEMPLATE_DIRS = (
    'C:/Users/Me/Django/mysite/templates', 
)

在mysite / polls / urls.py中:

from django.conf.urls import patterns, url

from polls import views

urlpatterns = patterns('',
    url(r'^$', views.index, name='index'),
    url(r'^(?P<poll_id>\d+)/$', views.detail, name='detail'),
    url(r'^(?P<poll_id>\d+)/results/$', views.results, name='results'),
    url(r'^(?P<poll_id>\d+)/vote/$', views.vote, name='vote'),
)

我可以发布任何其他必要的代码,但是如果我使用错误的网址,我应该如何更改以获取自定义500错误页面?

编辑

解决方案:我有一个额外的

TEMPLATE_DIRS

在我的settings.py中,这导致了问题

Following the tutorial found here exactly, I cannot create a custom 500 or 404 error page.If I do type in a bad url, the page gives me the default error page.Is there anything I should be checking for that would prevent a custom page from showing up?File directories:within mysite/settings.py I have these enabled:within mysite/polls/urls.py:I can post any other code necessary, but what should I be changing to get a custom 500 error page if I use a bad url?EditSOLUTION: I had an additionalwithin my settings.py and that was causing the problem

问题:

我正在运行(bio)python脚本,导致以下错误:

from: can't read /var/mail/Bio

看到我的脚本与邮件没有任何关系,我不明白为什么我的脚本在/ var / mail中查找。

这里似乎是什么问题? 我怀疑这会有所帮助,因为脚本似乎不是问题所在,但是无论如何这是我的脚本:

from Bio import SeqIO
from Bio.SeqUtils import ProtParam

handle = open("examplefasta.fasta") 
for record in SeqIO.parse(handle, "fasta"): 
    seq = str(record.seq)
    X = ProtParam.ProteinAnalysis(seq)
    print X.count_amino_acids() 
    print X.get_amino_acids_percent() 
    print X.molecular_weight() 
    print X.aromaticity() 
    print X.instability_index() 
    print X.flexibility() 
    print X.isoelectric_point() 
    print X.secondary_structure_fraction()

这里有什么问题? 错误的python设置? 我真的不认为这是脚本。

I am running a (bio)python script which results in the following error:seeing as my script doesn’t have anything to with mail, I don’t understand why my script is looking in /var/mail.What seems to be the problem here?i doubt it will help as the script doesn’t seem to be the problem, but here’s my script anyway:what is the problem here?bad python setup?I really don’t think it’s the script.