(1)p1 = multiprocessing.Process(test1)
p2 = multiprocessing.Process(target=test2)
错误: p1缺少target,应为(target=test1)
Traceback (most recent call last):

  File "D:/untitled/多进程练习.py", line 11, in <module>
    p1 = multiprocessing.Process(test1)
  File "D:\python\lib\multiprocessing\process.py", line 74, in __init__
    assert group is None, 'group argument must be None for now'
AssertionError: group argument must be None for now

(2)  在有进程程序中,没有代码:if __name__ == __main__: 会出现如下错误

RuntimeError: RuntimeError      if __name__ == '__main__': 的作用:防止被被其他文件导入时显示多余的程序主体部分
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.
        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:
            if __name__ == '__main__':
                freeze_support()
                ...
        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.
        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:
            if __name__ == '__main__':
                freeze_support()
                ...
        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
子进程会在运行时拷贝当前主进程中的所有内容,这也就意味着当一个新的子进程被创建的时候,该子进程就会复制当前模块,当然也包括了以下两行:
 
multiprocessing.Process(target=test1).start()
multiprocessing.Process(target=test).start()
很显然,这样的写法可能形成无限递归式地创建新的子进程。所以为了避免以上情况发生,我们在此引入了 if __name__ == __main__: 。

AssertionError的更多相关文章

  1. 开着idea,死机了,关机重启。重启之后,重新打开idea报错java.lang.AssertionError:upexpected content storage modification

    开着idea,死机了,关机重启.重启之后,重新打开idea报错java.lang.AssertionError:upexpected content storage modification. goo ...

  2. [改善Java代码]在switch的default代码块中增加AssertionError错误

    switch的后跟枚举类型,case后列出所有的枚举项,这是一个使用枚举的主流写法,那留着default语句似乎没有任何作用了,程序已经列举出了所有的可能选项,肯定不会执行到default语句,. 错 ...

  3. 【Flask】报错解决方法:AssertionError: View function mapping is overwriting an existing endpoint function: main.user

    运行Flask时出现了一个错误, AssertionError: View function mapping is overwriting an existing endpoint function: ...

  4. 解决用try except 捕获assert函数产生的AssertionError异常时,导致断言失败的用例在测试报告中通过的问题

    在使用Python3做自动化测试过程中可能会遇到,assert函数不加try  except,就可以正常在报告里体现用例不通过,加上变成通过. 这是因为在使用try except 时,捕获了asser ...

  5. 运行gulp项目报错:AssertionError: Task function must be specified。

    一.问题描述: gulp项目在本地windows 10机器上跑没有任何问题,但是放在centos 7虚拟机上跑报错:AssertionError: Task function must be spec ...

  6. 出现“java.lang.AssertionError: SAM dictionaries are not the same”报错

    运行一下程序时出现“java.lang.AssertionError: SAM dictionaries are not the same”报错 java -jar picard.jar SortVc ...

  7. rest framework错误笔记——AssertionError: Cannot apply DjangoModelPermissionsOrAnonReadOnly on a view that does not set `.queryset` or have a `.get_queryset()` method.

    用到@api_view装饰器时,访问路由查看api数据时,报错: AssertionError: Cannot apply DjangoModelPermissionsOrAnonReadOnly o ...

  8. AssertionError: View function mapping is overwriting an existing endpoint function: admin.main

    刚才给views.py文件添加了一个路由地址: @admin_view.route('/test', methods=["get", "post"]) @log ...

  9. EasyMock set方法报错: java.lang.AssertionError

    有返回值的方法没问题, 直接andReturn就行了. EasyMock.expect(info.getWebTitle()).andReturn(StringUtils.EMPTY).anyTime ...

随机推荐

  1. Linux - Seafile

    0. 摘要 Seafile 是一款开源的企业云盘,注重可靠性和性能.支持 Windows, Mac, Linux, iOS, Android 平台.支持文件同步或者直接挂载到本地访问. AWS(亚马逊 ...

  2. 【转】Android SDK,ADT,API 版本的对应关系

    写对应关系之前,先了解一下几个名字的含义. 一. Android ADT: 按照官方网站的开发介绍:Android Development Tools (ADT) is a plugin for th ...

  3. Hadoop学习之路(一)理论基础和逻辑思维

    三个题目 第一题 问题描述 统计出当前这个一行一个IP的文件中,到底哪个IP出现的次数最多 解决思路 //必须要能读取这个内容 BufferedReader br = new BuffedReader ...

  4. Service通信

    1.简介 Service通信是双向的, 它不仅可以发送消息, 同时还会有反馈. 所以service包括两部分, 一部分是请求方( Clinet) , 另一部分是应答方/服务提供方( Server) . ...

  5. nginx学习要点记录

    IO多路复用: 1.轻量 2.cpu亲和性:把CPU核心和nginx工作进程绑定,把每个worker进程固定在一个CPU上执行,减少切换cpu的cache miss,获得更好的性能 3.IO多路复用e ...

  6. CAN总线实际运用分析问题。

    组态设计   人机交互  上位机  分布式控制系统  下位机  (单片机/PLC)  CAN总线用线缆   连接方式(手牵手,T型)    CAN总线接地(大地) http://bbs.gongkon ...

  7. Vue+axios 实现http拦截及vue-router拦截

    现如今,每个前端对于Vue都不会陌生,Vue框架是如今最流行的前端框架之一,其势头直追react.最近我用vue做了一个项目,下面便是我从中取得的一点收获. 基于现在用vue+webpack搭建项目的 ...

  8. Go语言相对于C++的优点

    Go语言是Google公司在2009年开源的一门高级编程语言,它为解决大型系统开发过程中的实际问题而设计,支持并发.规范统一.简单优雅,被很多Go语言传道者誉为“互联网时代的C语言”.而C++语言诞生 ...

  9. Kotlin基础篇(一)

    写在前面: 因为工作需要,目前转安卓开发,用的IDE是AS3.2版本,语言的话,用的是Kotlin.由于之前是做.NET的,没接触过这方面的东西,所以完全是小白一枚.所以想着开个博客,以此来记录自己的 ...

  10. NoSQL入门第二天——Redis入门介绍

    一.基本概述 1.是什么 Redis:REmote DIctionary Server (远程字典服务器) 是完全开源免费的,用C语言编写的,遵守BSD协议, 是一个高性能的(key/value)分布 ...