Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ PyCharm new Python file name and the name of the module will import the same problem might arise     - To learn linux security (Linux)

- Processor in protected mode of protection (Linux)

- Linux System Getting Started Learning: Disable HTTP forwarding wget in (Linux)

- On the Web application attack techniques Common (Linux)

- Standard and IO redirection (Linux)

- Ubuntu under VirtualBox virtual machine serial port settings (Linux)

- Try debugfs restore the deleted files ext3 file system (Linux)

- CentOS 7 install Hadoop-cdh-2.6 (Server)

- Detailed usage history command (Linux)

- CentOS 6.5 three ways to configure the IP address (Linux)

- Ubuntu 14.10 / 14.04 / 12.04 virtual users to install the printing software Boomaga (Linux)

- Oracle query start with connect by tree (Database)

- Linux Command-line MySQL summary (Database)

- Ubuntu deployment Flask + UWSGI + Nginx Comments (Server)

- Defensive programming in PHP (Programming)

- Squid proxy server configuration under Linux (Server)

- Java reflection mechanism explained in detail and Method.invoke explanation (Programming)

- CentOS Linux build SVN server (Server)

- For the FreeBSD install Adobe Flash plug-in (Linux)

- Linux System Getting Started Learning: In RedHat Linux driver compiled Ixgbe (Linux)

 
         
  PyCharm new Python file name and the name of the module will import the same problem might arise
     
  Add Date : 2018-11-21      
         
         
         
  Problem

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.

import subprocess

def test ():
     subprocess (( 'ls', '-l')

if __name__ == '__main__:
     test ()
analysis

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! ! ! !
     
         
         
         
  More:      
 
- Use Pylint regulate your Python code (Programming)
- SSH does not require a password to log on to a Linux server (Server)
- Java environment to build a number of issues (Linux)
- Ubuntu / Fedora / CentOS system how to install Plex Media Server 0.9.9 (Linux)
- Linux Disk and File Management (Linux)
- Linux how to prohibit the use of Ping command (Linux)
- Java to achieve local fileCopy (Programming)
- About Nginx 7 (Server)
- Under Linux using Magent + Memcached cache server cluster deployment (Server)
- Red Hat Linux security settings document (Linux)
- CentOS 6.5 makes the LAN http source (Linux)
- Linux user groups, file permissions Detailed (Linux)
- CentOS yum configuration under local sources (Linux)
- Mount and unloading disks under Linux (Linux)
- Service manager OpenBSD on rccl (Server)
- MySQL5.6.17 compiler installation under CentOS (Database)
- Python image processing library (PIL) to install and simple to use (Linux)
- On event processing browser compatibility notes (Programming)
- Applications Linux leap second problem caused (Linux)
- Docker installation under CentOS7 (Linux)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.