Pyserial again

Grant Edwards grante at
Mon Mar 6 22:30:22 CET 2006

On 2006-03-06, Luca <superlogan72 at> wrote:

>>> Another point is the textctrl: it store only the first byte
>>> and not the other why?, the byte are like 22 and all are
>>> readed
>> No clue.  I don't know what "textctrl" is or what it's
>> supposed to do.
>         a = ser.readline()
>         a = self.textCtrl3.SetValue(a + ' ')
> For my bad understanding is clear

Please, please, quote articles so that we can tell who said
what.  I've attempted to re-quote things to make it clear.

If textctrl isn't doing what you think it should, you need to 

 1) Create a _small_ program that demonstrates the problem.

 2) POST THAT PROGRAM in a thread with a the subject line that
    is likely to attract the attention of somebody who knows
    something about "textctrl".

>>> Sniffing the data with serial port monitor i see that the
>>> answer is ok but after the answer the port close, why?
>> What makes you think the port closed?
> The serial port monitor write com port close.

OK. Good. That's useful information.  I'm assuming that by
"serial port monitor" you mean something like the tool from
sysinternals?  It's important that you include details like that.

In the previous post, I thought you meant you were watching the
serial data stream on the cable with a protocol analyzer or
with another PC.  I didn't understand how you would know the
port had been closed by watching the data on the cable.  You
said you were sniffing the _data_, and you can't tell by
looking at _data_ that the port has been closed -- so I had to
ask how you knew the port had been closed.

Now, if you'll just post the Python code we can probably tell
you what's wrong.  

Since you haven't shown us the code, all we can do is guess.

I've already made my guess: the serial port object is going
out-of-scope and getting garbage collected.  If you don't know
what that means, let us know, and we'll explain it in more

> As you know i'm not a programmer, but i try to do this in my
> free time.

That's fine.  We're all willing to help, but you have to work
with us.  The best/fastest way to solve your problem is to
write a small program that demonstrates the problem and post
it.  Then we can look at it and tell you what's wrong.

You could post your entire program, but the more code you post,
less likely it is that people are going to sort through it to
figure out what's wrong.

If you can post a 15-20 line program that doesn't do what you
think it should, I guarantee you'll get a quick answer
explaining what you've done wrong.

If you post a 1500 line program, nobody is going to read it.

It's theoretically possible to post a precise enough natural
language (e.g. English) description of the problem such that
somebody might be able to figure out what's wrong.  But,
writing a description that is precise enough is very difficult
even for somebody who is good at Python and a native English

Its much easier to write a small program that demonstrates the

> Probably you have reason to write:
> The code you post is irrelevant.
> But i try to do my best as in my possibility.

If you want us to tell you what's wrong with your code, you
_have_to_show_it_to_us_.  It's usually pointless for us to try
to guess.

There is a big problem with just posting a few lines of code
out of a larger program: unless you know what's wrong, you
don't know which lines of code to post.  If you don't know what
the problem is, you're probably posting the wrong chunk of

> I think that in any case you can't run my code if you haven't
> the same device that i have.

Even if we can't run the code, we can still look at it.

Ideally, you should create a small program that demonstrates
your problem.  Make it as small as you can.  Leave out anything
that isn't related to the problem you're trying to solve.

If you refuse to post code that demonstrates your problem,
there's very little chance we'll correctly guess what you've

> So i don't want that you loose time with my stupid question,
> i'm sure you have a lot of better things to do that help a
> beginner like me.

We were all beginners at one time.  Teaching people is rarely a
waste of time unless they don't want to be taught.  But you
have to help us solve your problem. 

Grant Edwards                   grante             Yow!  While I'm in
                                  at               LEVITTOWN I thought I'd
                                 like to see the NUCLEAR

More information about the Python-list mailing list