推荐学习书目
› 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
oldbird
V2EX  ›  Python

命令行单步运行可以,脚本运行报错是什么原因

  •  
  •   oldbird · Jan 8, 2021 · 2402 views
    This topic created in 2095 days ago, the information mentioned may be changed or developed.

    在 IDE 的 shell 里单步运行 import A 可以,

    在 IDE 的编辑器里直接运行 py 文件,或者在 CMD 里单步运行 import A 报错,

    提示是该模块的 init 文件中 有一行 from A.b import *

    SystemError:initialization of b raised unreported exception

    init.py 同目录下有 b.pyd 文件

    2 replies  •  2021-01-08 22:29:28 +08:00
    dorothyREN
        1
    dorothyREN  
       Jan 8, 2021
    是不是有同名的。。
    nthhdy
        2
    nthhdy  
       Jan 8, 2021
    有可能是 b 中有一些额外的启动条件,比如对环境变量、启动路径有要求。可能不是 import 机制的问题,因为报的不是 ImportError,所以不是找不到模块、包的问题。可以想办法找找 b 的源码,看看里面做了什么。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2273 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 09:35 · PVG 17:35 · LAX 02:35 · JFK 05:35
    ♥ Do have faith in what you're doing.