python, pyserial windows xp [error 5] access denied

Thanks, I think you have found the problem. I get [error 5] if I open the arduino serial monitor before I run my python script.

I do not get the error if I just plug in the arduino and then run my python script.

Thank you for all your help.

I modified my python code to the following:

import serial

serialport = "com3"
ser = serial.Serial(serialport, 9600)
while(1):
val=ser.readline()
print (val)

And I was expecting to see the same output that I saw on the serial monitor, but I am getting the output in a different format. Instead of just printing a number between 0 and 255 it is printing b' 0\r\n thru b' 255\r\n. Can you help me understand why it is printing values like this?