the below code is executing simple python script from Windows excel VBA Shell on 1 machine, but not on the other.
Sub RunIt()
CreateObject("wscript.shell").Run "python.exe " & """\\acntnyc039\dept\HGS\Bob\test_syst_arg2.py""", 1, True
'same as
Shell "python.exe ""\\acntnyc039\dept\HGS\Bob\test_syst_arg2.py""", 1
End Sub
corresponding python:
import pandas as pd
import sys
path = r'\\acntnyc039\dept\HGS\Bob\test\test.csv'
raw_data = {'first_name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'],
'last_name': ['Miller', 'Jacobson', 'Ali', 'Milner', 'Cooze'],
'age': [42, 52, 36, 24, 73],
'preTestScore': [4, 24, 31, 2, 3],
'postTestScore': [25, 94, 57, 62, 70]}
df = pd.DataFrame(raw_data, columns = ['first_name', 'last_name', 'age',
'preTestScore', 'postTestScore'])
df.to_csv(path)
i've read all similar threads and checked the following:
- both users have identical non-admin access, yet it does not execute for one of them producing no error message (but cmd opens)
- network path does not have spaces
- the same line runs just fine from cmd directly
- python is found when typing
python
fromcmd
, but still tried replacing python withpython.exe
along with full path topython.exe
in VBA string above to no avail - full anaconda3 reinstall did not fix the problem
- shell seems to be working fine on non-python code as in:
Shell "notepad.exe ""\\acntnyc039\dept\HGS\Bob\test\test.csv""", 1
i'm really running out of ideas here ...