Python output printed too late

Bug #271742 reported by Antti Kaihola
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyreport
Fix Committed
Undecided
Unassigned

Bug Description

When compiling the attached .py source, the output from one of the Python "print" statements doesn't appear below the statement. It's printed just before the output of the next statement instead.

I'm on Ubuntu Hardy and running the current trunk of pyreport:
revision-id: <email address hidden>
date: 2008-01-28 10:52:23 +0100
build-date: 2008-09-18 16:18:30 +0300
revno: 26
branch-nick: pyreport

Revision history for this message
Antti Kaihola (akaihola) wrote :
Revision history for this message
Antti Kaihola (akaihola) wrote :
Revision history for this message
andrew hutchison (drew-blacksky) wrote :

This is (sort of) fixed under revno 35 running under python 2.6. Some weirdness was going on with the parsing code that behaves differently between the versions. Unfortunately, now all code blocks are preceded by a blank line, and code output follows the subsequent rst comment. This should be a pretty easy fix, I'm having a go at it now.

Revision history for this message
Kamel (kamel-maths) wrote :

Hi,

I have the same problem. The output arrive too late.
I'm on ubuntu hardy and python 2.5.2. How can i do ?

thanks in advance.

Revision history for this message
Kamel (kamel-maths) wrote :

It seems that the problem occurs whith comments as #! .
Without comments, it works pefectly.
Is there a solution with my configuration ?

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote :

I believe that I fixed this problem in revision 39 of the development version of pyreport. There should be a new release, but I'd love feedback on this issue.

And sorry for the slow answer, I have been struggling with so many things to do.

Changed in pyreport:
status: New → Fix Committed
Revision history for this message
Kamel (kamel-maths) wrote :

You don't have to be sorry for the slow answer. I love your work and I accept to wait for that.

I don't know what is the revision 39. The version of pyreport I use is the 0.3.4a that I found in your homepage. A few minutes ago, I saw that there exists a younger version, the 0.3.4b at http://pypi.python.org/simple/pyreport/.
I have downloaded it to see if the problem still occurs with this version, but after extract it, I don't know how to install it.

Thanks.

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote : Re: [Bug 271742] Re: Python output printed too late

On Fri, Nov 13, 2009 at 08:44:01PM -0000, Kamel wrote:
> You don't have to be sorry for the slow answer. I love your work and I
> accept to wait for that.

> I don't know what is the revision 39. The version of pyreport I use is the 0.3.4a that I found in your homepage. A few minutes ago, I saw that there exists a younger version, the 0.3.4b at http://pypi.python.org/simple/pyreport/.
> I have downloaded it to see if the problem still occurs with this version, but after extract it, I don't know how to install it.

You should be able to instal it using 'python setup.py install', in the
directory of the tarball. The way to install it is excatly the same way
as version 0.3.4a.

Hope this helps,

Gaël

Revision history for this message
Kamel (kamel-maths) wrote :

Sorry, I am completely lost.

I tried to install the version 0.3.4b but the version recognized by my computer still was the 0.3.4a. So I delete some files manually (I know it is not good but I was angry). Then I begin again to install the 0.3.4b. I have the impression all is ok but when I call pyreport I have : bash : pyreport : commande introuvable.

This is the message I have after 'python setup.py install' :
/usr/lib/python2.5/distutils/dist.py:263: UserWarning: Unknown distribution option: 'summary'
  warnings.warn(msg)
running install
running build
running build_py
running install_lib
running install_egg_info
Removing /usr/lib/python2.5/site-packages/pyreport-0.3.4b.egg-info
Writing /usr/lib/python2.5/site-packages/pyreport-0.3.4b.egg-info

But after nothing ...
Thanks for your help.

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote :

On Sat, Nov 14, 2009 at 10:12:15PM -0000, Kamel wrote:
> Sorry, I am completely lost.

> I tried to install the version 0.3.4b but the version recognized by my
> computer still was the 0.3.4a. So I delete some files manually (I know
> it is not good but I was angry). Then I begin again to install the
> 0.3.4b. I have the impression all is ok but when I call pyreport I have
> : bash : pyreport : commande introuvable.

OK, your previous problem may be due to pyreport being installed via
'easy_install', and thus overriding the standard install. Can you try
install pyreport via easy_install, by typing the following command:

easy_install pyreport

Tell me if this works.

Gaël

Revision history for this message
Kamel (kamel-maths) wrote :

Thank you for your patience.

The message after 'easy_install pyreport' :
Searching for pyreport
Best match: pyreport 0.3.4b
Processing pyreport-0.3.4b-py2.5.egg
pyreport 0.3.4b is already the active version in easy-install.pth
Installing pyreport script to /usr/bin

Using /usr/lib/python2.5/site-packages/pyreport-0.3.4b-py2.5.egg
Processing dependencies for pyreport
Finished processing dependencies for pyreport

Then the message when I call pyreport :
Traceback (most recent call last):
  File "/usr/bin/pyreport", line 8, in <module>
    load_entry_point('pyreport==0.3.4b', 'console_scripts', 'pyreport')()
  File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 277, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2178, in load_entry_point
    raise ImportError("Entry point %r not found" % ((group,name),))
ImportError: Entry point ('console_scripts', 'pyreport') not found

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote :

Hey Kamel,

This might very well be due to an error on my side. I just uploaded a
version 0.3.4c, can you try easy_install again?

Thanks,

Gaël

On Sun, Nov 15, 2009 at 02:35:38PM -0000, Kamel wrote:
> Thank you for your patience.

> The message after 'easy_install pyreport' :
> Searching for pyreport
> Best match: pyreport 0.3.4b
> Processing pyreport-0.3.4b-py2.5.egg
> pyreport 0.3.4b is already the active version in easy-install.pth
> Installing pyreport script to /usr/bin

> Using /usr/lib/python2.5/site-packages/pyreport-0.3.4b-py2.5.egg
> Processing dependencies for pyreport
> Finished processing dependencies for pyreport

> Then the message when I call pyreport :
> Traceback (most recent call last):
> File "/usr/bin/pyreport", line 8, in <module>
> load_entry_point('pyreport==0.3.4b', 'console_scripts', 'pyreport')()
> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 277, in load_entry_point
> return get_distribution(dist).load_entry_point(group, name)
> File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2178, in load_entry_point
> raise ImportError("Entry point %r not found" % ((group,name),))
> ImportError: Entry point ('console_scripts', 'pyreport') not found

Revision history for this message
Kamel (kamel-maths) wrote :

I've just tried 'easy_install' but this still installs 0.3.4b and not 0.3.4c :

kamel@kamel-desktop:~$ sudo easy_install pyreport
Searching for pyreport
Best match: pyreport 0.3.4b
Processing pyreport-0.3.4b-py2.5.egg
pyreport 0.3.4b is already the active version in easy-install.pth
Installing pyreport script to /usr/bin

Using /usr/lib/python2.5/site-packages/pyreport-0.3.4b-py2.5.egg
Processing dependencies for pyreport
Finished processing dependencies for pyreport

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote :

On Sun, Nov 15, 2009 at 05:07:30PM -0000, Kamel wrote:
> I've just tried 'easy_install' but this still installs 0.3.4b and not
> 0.3.4c :

Ha, yes, you need to give the '-U' flag to easy_install:

easy_install -U pyreport

Gaël

Revision history for this message
Kamel (kamel-maths) wrote :

Yes, it works and no more problem of too late output. Thanks a lot for that.

I have another question (less important) about pyreport but I don't know if it is the right place to ask.
It is about the first line #!/usr/bin/env python of a script. On my computer with pyreport it is interpreted as a comment of the report (rst line ?) and not as a python comment. So I don't obtain the same result as your examples of your homepage. Is it normal ?

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote :

On Sun, Nov 15, 2009 at 08:16:04PM -0000, Kamel wrote:
> Yes, it works and no more problem of too late output.

Excellent!

> I have another question (less important) about pyreport but I don't know if it is the right place to ask.
> It is about the first line #!/usr/bin/env python of a script. On my computer with pyreport it is interpreted as a comment of the report (rst line ?) and not as a python comment. So I don't obtain the same result as your examples of your homepage. Is it normal ?

It looks like a bug. I'll try to work on it later in the week. Right now
I have a few deadlines to work on.

Gaël

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.