Interrupted during the test period the following code, the runtime always found Pycharm being given tips: AttributeError: 'module' object has no attribute 'call'.
But in Python interpreter directly enter the following code without any problem, it is very strange.
def test ():
subprocess (( 'ls', '-l')
if __name__ == '__main__:
Python3 input into the interpreter environment in Pycharm in the Terminal;
Import module subprocess in the interpreter;
Input dir (subprocess), we found the problem and found that the subprocess module does not call method. I think of the current file name is subprocess.py, so when you import the module, Pycharm default import this.
After the file name changes, the test can be a normal operation.
to sum up
Do not let the new file name and common name of the module in the same pycharm! ! ! Otherwise, it may cause the module to import failure occurs! ! ! Remember! ! ! !