Uttama_vizard
06-28-2008, 01:45 PM
Hello,
I am trying to do a file management of a number of .py files each of which has a sequence of operations.
To mark the event (that is completion of execution of one .py file), I was trying to send something to the serial port by using........
character1.scale(0,0,0)# (say), this is end of execution of 1.py file.
ser = serial.Serial() #Use the Serial port
ser.baudrate = 9600
ser.port = 'COM3'
ser.open()
ser.write('s')
x = ser.read()
print x
When I am executing my 1.py file, I am getting 's' in the input/output window.
Like this there will be 2.py, 3.py....files.
From my master .py file, I am trying to execute one after another...
def FileManagement():
#Set variables
count = 0
if count == 0:
import 1.py
ser = serial.Serial()
ser.baudrate = 9600
ser.port = 'COM3'
ser.open()
x = ser.read()
print x
count += 1
if count == 1:
import 2.py
count += 1
if count == 2:
import 3.py
count += 1
if count == 3:
import 4.py
Now, I want to mark the end of execution of each .py file.
In doing so when I am trying to read the serial port where I have written already during execution of the 1.py, 2.py....files, from my master .py file, I am getting error messages
Traceback (most recent call last):
File "C:\Program Files\WorldViz\Vizard3002701\Vizard30\python\vizta sk.py", line 676, in __onupdate
self.__task = [ t for t in self.__task if not t.update() ]
File "C:\Program Files\WorldViz\Vizard3002701\Vizard30\python\vizta sk.py", line 643, in update
val = self.__stack[-1].next()
File "Sum08_Demo1_NEC_1A_4p5F.py", line 135, in StartStory
ser.open()
File "C:\Program Files\WorldViz\Vizard3002701\Vizard30\bin\lib\site-packages\serial\serialwin32.py", line 49, in open
raise SerialException("could not open port %s: %s" % (self.portstr, msg))
serial.serialutil.SerialException: could not open port COM3: (5, 'CreateFile', 'Access is denied.')
Is it a problem with accessing the same port multiple times....or may be a synchronization problem...that is when the port is being written, it is not being opened for reading.
Thanks in advance for any valuable suggestion....regarding this problem....or for any other suggested better ways of doing the file management.
Thanks
Uttama
I am trying to do a file management of a number of .py files each of which has a sequence of operations.
To mark the event (that is completion of execution of one .py file), I was trying to send something to the serial port by using........
character1.scale(0,0,0)# (say), this is end of execution of 1.py file.
ser = serial.Serial() #Use the Serial port
ser.baudrate = 9600
ser.port = 'COM3'
ser.open()
ser.write('s')
x = ser.read()
print x
When I am executing my 1.py file, I am getting 's' in the input/output window.
Like this there will be 2.py, 3.py....files.
From my master .py file, I am trying to execute one after another...
def FileManagement():
#Set variables
count = 0
if count == 0:
import 1.py
ser = serial.Serial()
ser.baudrate = 9600
ser.port = 'COM3'
ser.open()
x = ser.read()
print x
count += 1
if count == 1:
import 2.py
count += 1
if count == 2:
import 3.py
count += 1
if count == 3:
import 4.py
Now, I want to mark the end of execution of each .py file.
In doing so when I am trying to read the serial port where I have written already during execution of the 1.py, 2.py....files, from my master .py file, I am getting error messages
Traceback (most recent call last):
File "C:\Program Files\WorldViz\Vizard3002701\Vizard30\python\vizta sk.py", line 676, in __onupdate
self.__task = [ t for t in self.__task if not t.update() ]
File "C:\Program Files\WorldViz\Vizard3002701\Vizard30\python\vizta sk.py", line 643, in update
val = self.__stack[-1].next()
File "Sum08_Demo1_NEC_1A_4p5F.py", line 135, in StartStory
ser.open()
File "C:\Program Files\WorldViz\Vizard3002701\Vizard30\bin\lib\site-packages\serial\serialwin32.py", line 49, in open
raise SerialException("could not open port %s: %s" % (self.portstr, msg))
serial.serialutil.SerialException: could not open port COM3: (5, 'CreateFile', 'Access is denied.')
Is it a problem with accessing the same port multiple times....or may be a synchronization problem...that is when the port is being written, it is not being opened for reading.
Thanks in advance for any valuable suggestion....regarding this problem....or for any other suggested better ways of doing the file management.
Thanks
Uttama