matplotlib pylab plot() BadWindow error

2008-05-04 Thread oyinbo55
I am trying to use the pylab plot command on my laptop running Ubuntu
6.06 (Dapper).  Although the plot command works fine on my XP desktop
at work, I cannot open the plot window on the laptop.  I edited
matplotlibrc to change interactive: to "True".  In idle, I entered the
commands:
 >>> from pylab import *
 >>> plot([1,2,3])

The terminal window closed abruptly when I typed the closing
parenthesis.
I have been warned not to use the show() command in interactive mode.
I tried:
 [EMAIL PROTECTED]:~$ idle-python2.4 -n
In idle -n, I entered the sam two commands.  This time I got an error
message:
 The program 'idle-python2.4' received an X Window System error.
 This probably reflects a bug in the program.
 The error was 'BadWindow (invalid Window parameter)'.
   (Details: serial 2875 error_code 3 request_code 15 minor_code
0)
   (Note to programmers: normally, X errors are reported
asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error()
function.)

Using the Python prompt without idle, I got no error message, but the
window simply didn't open:

 [EMAIL PROTECTED]:~$ python
 Python 2.4.3 (#2, Mar  7 2008, 01:58:20)
 [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
 Type "help", "copyright", "credits" or "license" for more
information.
 >>> from pylab import *
 >>> plot([1,2,3])
 []

Have I skipped a step?

Thanks for all the great information on your group.

Bill
--
http://mail.python.org/mailman/listinfo/python-list


Pyserial non-standard baud rate

2009-10-01 Thread oyinbo55
Hello all: this is my first post. I hope I'm doing it right.
I have a digital multimeter that sends data through an RS232 interface
at 19230 baud. I would like to record and graph the output in Python.
Pyserial does not want me to set the baudrate at a non-standard value:

>>>ser=serial.Serial('/dev/ttyUSB0' ,baudrate = 19230, bytesize = 7, parity = 
>>>'N', stopbits = 1)
ValueError : Invalid baud rate : 19230

Using the standard 19200 baud results in gobbledegook from the
multimeter.

How can I connect to this device?

I am using Python 2.5.1 running on Ubuntu 4.2.3 using IDLE 1.2.2

Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pyserial non-standard baud rate

2009-10-01 Thread oyinbo55
On Oct 1, 11:36 am, "Richard Brodie"  wrote:
> "oyinbo55"  wrote in message
>
> news:2feb36fc-106c-4d7c-a697-db59971dc...@a7g2000yqo.googlegroups.com...
>
> > Using the standard 19200 baud results in gobbledegook from the
> > multimeter.
>
> You aren't going to notice a 0.1% clock skew within 1 byte.
> Forget about the difference between 19200 and 19230.
>
> If you have a scope handy, see what the output waveform
> looks like, and check the timings. If not play around with
> the rates, parity etc., until you find something that works.

Thank you, Richard, you are absolutely right.  Looking back at the
documentation for the instrument, I found the following:

"The data format complies with JIS 7Bits-transmission code with a baud
rate of 19230. "

I had overlooked the JIS transmission code because I didn't know what
that meant.  (It is the Japanese Industrial Standard).  Changing my
script to display the data one character at a time, I found it was
sprinkled with escape characters that Japanese machines use to switch
from ASCII to Kanji characters and back.

Does Python have a module that will translate the data stream and
display normal ASCII characters?  The escape codes appear to alter the
values of the characters in some systematic way.

Thanks again for your help.
-- 
http://mail.python.org/mailman/listinfo/python-list