推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
linuxchild
V2EX  ›  Python

Python 的 pp 模块 提示变量未定义错误

  •  
  •   linuxchild · Sep 23, 2017 · 2494 views
    This topic created in 3163 days ago, the information mentioned may be changed or developed.

    啊,实际上这个主题是因为这个问题

    现在想使用 pp 模块试一下,代码如下:

    cpu_num = 8
        job_server = pp.Server(cpu_num)
        a =  []
        for f in file_lists:
            a.append(job_server.submit(func_name, (f, ), (fun_1, func_2, ), ('sys', 'datetime', 'pp')))
        for x in a:
            tmp = x()
    

    提示的错误如下:

    An error has occured during the function execution
    Traceback (most recent call last):
      File "/usr/lib/python2.6/site-packages/ppworker.py", line 90, in run
        __result = __f(*__args)
      File "<string>", line 2, in decrypt_file
    NameError: global name 'xxx' is not defined
    

    这个 xxx 变量是我在文件开头定义的一个变量,确定已经定义了… 哪位用过这个,对这个比较熟悉

    Supplement 1  ·  Sep 23, 2017
    唔,把那些变量在函数里重新定义就好了……还没深究其原因
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3122 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 10:47 · PVG 18:47 · LAX 03:47 · JFK 06:47
    ♥ Do have faith in what you're doing.