I'm having a problem with Python programming. In my program I use a os.startfile()
to start a program but it won't let me.
When my program is executing the command to start the file I get the following error in the Windows Script Host:
Script: C:\Users\Personal Name\Desktop\Program\Files\Volume\Volume Max\Volume Max.vbs
Line: 3
Token: 1
Error: Can't find the file.
Code: 80070002
Source (null)
I have the file exactly where the path goes and the name is spelled correctly. I've double checked. I removed the spaces of the file name and I've looked up the error code I got with no success because Windows have the same error for other Windows files.
Now I'm maybe out way wrong and this is not a Python error but I think so.
Code:
import socket
import time
import os
host = '192.168.56.1'
port = 5000
clients = []
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind((host, port))
s.setblocking(0)
quitting = False
print ("Server Started")
while not quitting:
try:
data, addr = s.recvfrom(1024)
if ("Quit") in str(data):
quitting = True
print (time.ctime(time.time()) + str(addr) + str(data))
if "Volume Max" in data:
print ("Volume Max")
os.startfile('C:\\Users\\wbe0719\\Desktop\\Program\\Files\\Volume\\Volume Max\\Volume Max.vbs')
except:
pass
s.close()