我最近创建了一个脚本,可以将Exosite中的数据导出到CSV文件中。
该脚本运行了几个月,直到最近我才开始收到错误:
def Manager():
global sales_cash
global sales_creditcard
global sales_octopus
global cost_coke
global cost_mint
global cost_sandwich
global stock_sandwich
global stock_mint
global stock_coke
global accounts
global i
global names
global shop_revenue
global i
m_optionselect = input("1: Stock Price \n \n 2: Check inventory" \
"\n \n 3: Check Sales \n \n 4: Create new account" \
"\n \n 5: Buy stock \n \n " \
"6: Check Revenue \n \n 7: Quit")
if m_optionselect == "7":
StartUp()
elif m_optionselect == "3":
print("Sales by cash: $",sales_cash)
print("Sales by octopus: $",sales_octopus)
print("Sales by credit card: $",sales_creditcard)
Manager()
elif m_optionselect == "2":
print("Number of sandwiches", stock_sandwich)
print("Number of cokes", stock_coke)
print("Number of mint", stock_mint)
Manager()
elif m_optionselect == "1":
stock_change = input("Select item to change price: \n \n" \
"1: Sandwich \n \n 2: Coke \n \n 3:Mint")
if stock_change == "1":
sandwich_change = float(input("Enter new price"))
cost_sandwich = 0 + sandwich_change
Manager()
elif stock_change == "2":
coke_change = float(input("Enter new price"))
cost_coke = 0 + coke_change
Manager()
elif stock_change == "3":
mint_change = float(input("Enter new price"))
cost_mint = 0 + mint_change
Manager()
else:
print("Invalid input")
Manager()
elif m_optionselect == "4":
print("Available slots for Accounts: \n \n 1:",names[0], "\n \n 2:", \
names[1], "\n \n 3:", names[2], "\n \n 4:", names[3], \
"\n \n 5:", names[4], "\n \n 6:", names[5], "\n \n 7:", \
names[6])
account_create = input("Which account slot to fill up (1-6): ")
if account_create == "1":
names[0] = input("Enter name of account holder")
accounts[0] = input("Enter password of account holder")
elif account_create == "2":
names[1] = input("Enter name of account holder")
accounts[1] = input("Enter password of account holder")
elif account_create == "3":
names[2] = input("Enter name of account holder")
accounts[2] = input("Enter name of account holder")
elif account_create == "4":
names[3] = input("Enter name of account holder")
accounts[3] = input("Enter name of account holder")
elif account_create == "5":
names[4] = input("Enter name of account holder")
accounts[4] = input("Enter name of account holder")
elif account_create == "6":
names[5] = input("Enter name of account holder")
accounts[5] = input("Enter name of account holder")
elif account_create == "7":
names[6] = input("Enter name of account holder")
accounts[6] = input("Enter name of account holder")
else:
print("Invalid input, enter again")
Manager()
Manager()
elif m_optionselect == "5":
add_stock_choice = input("1: Sandwich \n \n 2: Coke \n \n 3: Mint")
if add_stock_choice == "1" and shop_revenue >= 4:
add_stock_sandwich = int(input("$4.00/sandwich \n \n Enter amount"))
stock_sandwich = add_stock_sandwich + stock_sandwich
shop_revenue = shop_revenue - 4*(add_stock_sandwich)
Manager()
elif add_stock_choice == "2" and shop_revenue >= 2.5:
add_stock_coke = int(input("$2.50/coke \n \n Enter amount"))
stock_coke = add_stock_coke + stock_coke
shop_revenue = shop_revenue - 2.5*(add_stock_coke)
Manager()
elif add_stock_choice == "3" and shop_revenue >= 5:
add_stock_mint = int(input("$5.00/mint \n \n Enter amount"))
stock_mint = add_stock_mint + stock_mint
shop_revenue = shop_revenue - 5*(add_stock_mint)
Manager()
else:
print("Invalid Input")
Manager()
elif m_optionselect == "6":
print("The revenue is $",shop_revenue)
print("Total profit is $",shop_revenue-10000)
Manager()
else:
print("Invalid input")
Manager()
我的剧本中的第16行是:
File "archive_data_multiple_REC.py", line 16, in <module> from onepv1lib.onep import OnepV1
ImportError: No module named onepv1lib.onep
答案 0 :(得分:0)
我认为您的代码未从0.3
pyopen
版本迁移到0.7.4
。
从版本onepv1lib
开始,软件包名称已从pyopen
更新为0.7.4
。所以更新行
from onepv1lib.onep import OnepV1
到
from pyopen.onep import OnepV1
还要更新其他import语句以避免代码库中出现同样的错误。
答案 1 :(得分:-1)
也许您需要在控制台pip install onepv1lib