I need to run a python file in .bat mode. This file contains the zeep module and basically at the beginning of the file I import the zeep module and launch the file in run command of visual studio code where it is successfully executed. However, if I launch the bat file it gives me an error when importing the zeep module:
Traceback (most recent call last):
File “singleasset.py”, line 2, in
import zeep
ModuleNotFoundError: No module named ‘zeep
This is the code in .bat file:
ECHO ON
REM launch the script
SET PATH=%PATH%;C:Usershu0145AppDataLocalProgramsPythonPython37-
32
python singleasset.py
PAUSE
And this is the code in python file called in batch:
import os
import zeep
import sys
from zeep import Client
import datetime as dt
import pandas as pd
import toml
avePath = os.getcwd()
conf_file = open("./config.toml", "r")
raw_config = conf_file.read()
log_config = toml.loads(raw_config)
userId = log_config['b_credentials']['USER']
password = log_config['b_credentials']['PW']
clientId = log_config['b_credentials']['CLIENTID']
asset_ID = log_config['codice_strumento']['asset_ID']
# Create a zeep client
client = Client('https://www.barraone.com/bdti/BDTInteractive?wsdl')
# Login
client.service.Login(userId, clientId, password)
# Set Analysis Date
analysisDt = dt.date(2024, 7, 18)
client.service.SetAnalysisDate(analysisDt)
# Set Model
myModel = client.get_type('ns0:Model')()
myModel.Name = "MAC.L"
myModel.Owner = "SYSTEM"
client.service.SetModel(myModel)
6