简体   繁体   English

PyDAQmx导入混乱

[英]PyDAQmx importing confusion

I'm trying to use PyDAQmx. 我正在尝试使用PyDAQmx。 If I try to import like 如果我尝试导入像

    from PyDAQmx.DAQmxFunctions import *
    ...
    DAQmxResetDevice(ch) #unresolved

the function call is not recognized. 无法识别功能调用。 However the following works just fine: 但是,以下工作正常:

    import PyDAQmx.DAQmxFunctions as daq
    ...
    daq.DAQmxResetDevice(ch) #fine

Any idea why that might be? 知道为什么会这样吗? I'd like to use the first case just to avoid unnecessary clutter in my code since there will be a lot of function calls from that library. 我想使用第一种情况只是为了避免代码中不必要的混乱,因为该库中将有很多函数调用。 I know importing has been discussed to death and I looked at quite a few threads, but couldn't really find anything explaining my issue. 我知道导入已经被讨论到死了,我看了很多线程,但是找不到真正能解释我问题的东西。

FYI, python 2.7, PyCharm 4.5.3 Community Edition, NI-DAQ 14.5.1, PyDAQmx 1.3.1. FYI,python 2.7,PyCharm 4.5.3社区版,NI-DAQ 14.5.1,PyDAQmx 1.3.1。

PyDAQmx doesn't have an __all__ definition in its __init__.py : https://github.com/clade/PyDAQmx/blob/master/PyDAQmx/__init__.py PyDAQmx没有一个__all__在其定义__init__.pyhttps://github.com/clade/PyDAQmx/blob/master/PyDAQmx/__init__.py

Without an __all__ , Python doesn't know what to import . 没有__all__ ,Python不知道要导入什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM