简体   繁体   中英

Getting error While importing python module

I am trying to import another python file to my script.

My script is :

    import os
    from selenium import webdriver
    from selenium.webdriver.firefox.webdriver import WebDriver
    from selenium.webdriver.common.action_chains import ActionChains
    import time
    import sys
    sys.path.append('/Users/admin/Desktop/web_Suite/Scripts/funcLib.py')
    from funcLib import *

deviceSelection()

when I run this script, i am getting error :

 from funcLib import *
ImportError: No module named funcLib

What i am doing wrong here ? Can anyone please help

Append the folder funcLib is in, to sys.path, not the py file itself.

So sys.path.append('/Users/admin/Desktop/web_Suite/Scripts/')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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