from future import ...

Bug #399106 reported by Joe Coffey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyreport
New
Undecided
Unassigned

Bug Description

Pyreport seems like a great piece of software. Unfortunately a fair amount of my groups modules are loaded by an importer that prepends:

from __future__ import division, absolute_import

before the module. This seems to make using pyreport impossible. Is there anyway out? Removing from future import from the modules isn't an option. I don't have control over the codebase.

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote : Re: [Bug 399106] [NEW] from future import ...

On Tue, Jul 14, 2009 at 03:40:13AM -0000, Joe Coffey wrote:
> Pyreport seems like a great piece of software. Unfortunately a fair
> amount of my groups modules are loaded by an importer that prepends:

> from __future__ import division, absolute_import

> before the module. This seems to make using pyreport impossible. Is
> there anyway out? Removing from future import from the modules isn't an
> option. I don't have control over the codebase.

Do you want to send a patch adding an option to do this? I totally
sympathize with your points.

Gaël

Revision history for this message
Joe Coffey (joe-coffey) wrote :

I am not sure I understand what this is in your sentence. I don't know how
to patch pyreport to work in this situation. Unfortunately I'm a bit lost
in the meta programming required.

On Tue, Jul 14, 2009 at 12:02 AM, Gael Varoquaux <
<email address hidden>> wrote:

> On Tue, Jul 14, 2009 at 03:40:13AM -0000, Joe Coffey wrote:
> > Pyreport seems like a great piece of software. Unfortunately a fair
> > amount of my groups modules are loaded by an importer that prepends:
>
> > from __future__ import division, absolute_import
>
> > before the module. This seems to make using pyreport impossible. Is
> > there anyway out? Removing from future import from the modules isn't an
> > option. I don't have control over the codebase.
>
> Do you want to send a patch adding an option to do this? I totally
> sympathize with your points.
>
> Gaël
>
> --
> from future import ...
> https://bugs.launchpad.net/bugs/399106
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in pyreport: generate reports out of python scripts: New
>
> Bug description:
> Pyreport seems like a great piece of software. Unfortunately a fair amount
> of my groups modules are loaded by an importer that prepends:
>
> from __future__ import division, absolute_import
>
> before the module. This seems to make using pyreport impossible. Is there
> anyway out? Removing from future import from the modules isn't an option. I
> don't have control over the codebase.
>

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

On Tue, Jul 14, 2009 at 11:50:17AM -0000, Joe Coffey wrote:
> I am not sure I understand what this is in your sentence. I don't know how
> to patch pyreport to work in this situation. Unfortunately I'm a bit lost
> in the meta programming required.

OK, I have release a new version correcting this: 0.3.3. You can download
it from pypi:
http://pypi.python.org/pypi/pyreport
I have also changed a with details to make it work better on python 2.6.

Hope this helps,

Gaël

Revision history for this message
Joe Coffey (joe-coffey) wrote :

Thanks for your quick reply. However, this didn't fix it for me:

Basically if I have a file tester.py of the form:

from future import division, absolute_import

print "hi"

Then:

 /usr/local/bin/python2.6.1 pyreport.py tester.py

still kicks an error

Traceback (most recent call last):
  File "pyreport.py", line 1260, in <module>
    commandline_call()
  File "pyreport.py", line 1200, in commandline_call
    main(pyfile, overrides=options)
  File "pyreport.py", line 1256, in main
    compiler.compile( output_list, options.outfile, options)
  File "pyreport.py", line 959, in compile
    html_string = re.sub(r"</style>", protect(cssextra), html_string)
  File "pyreport.py", line 583, in protect
    return re.sub(r"\\", r"\\\\", string)
  File "/u/coffey/localpythonrecent/lib/python2.5/re.py", line 150, in sub
    return _compile(pattern, 0).sub(repl, string, count)
TypeError: __call__() takes at most 5 arguments (6 given)

This happens both under pthon 2.5.2 and 2.6.1 (64bit).

On Tue, Jul 14, 2009 at 1:32 PM, Gael Varoquaux <
<email address hidden>> wrote:

> On Tue, Jul 14, 2009 at 11:50:17AM -0000, Joe Coffey wrote:
> > I am not sure I understand what this is in your sentence. I don't know
> how
> > to patch pyreport to work in this situation. Unfortunately I'm a bit
> lost
> > in the meta programming required.
>
> OK, I have release a new version correcting this: 0.3.3. You can download
> it from pypi:
> http://pypi.python.org/pypi/pyreport
> I have also changed a with details to make it work better on python 2.6.
>
> Hope this helps,
>
> Gaël
>
> --
> from future import ...
> https://bugs.launchpad.net/bugs/399106
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in pyreport: generate reports out of python scripts: New
>
> Bug description:
> Pyreport seems like a great piece of software. Unfortunately a fair amount
> of my groups modules are loaded by an importer that prepends:
>
> from __future__ import division, absolute_import
>
> before the module. This seems to make using pyreport impossible. Is there
> anyway out? Removing from future import from the modules isn't an option. I
> don't have control over the codebase.
>

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

On Tue, Jul 14, 2009 at 07:43:29PM -0000, Joe Coffey wrote:
> Thanks for your quick reply. However, this didn't fix it for me:

> Basically if I have a file tester.py of the form:

> from future import division, absolute_import

> print "hi"

Ha, OK. Sorry, I hadn't understood your problem.

Sorry, I cannot fix this: the problem is that you cannot do imports from
__future__ unless you are right at the entry point. In other word, you
have to comment out or to try/except these lines. I can't fix this, and
you won't be able to run these files in another program, say an IDE. It
is a limitation of Python.

Gaël

Revision history for this message
Joe Coffey (joe-coffey) wrote :

That is what I was afraid of... This is probably insurmountable for us. (we
have a pretty involved bootstrat importing system which requires the
absolute_import. I'm not entirely sure why, but there it is...)

Thanks for your help.

On Tue, Jul 14, 2009 at 7:07 PM, Gael Varoquaux <
<email address hidden>> wrote:

> On Tue, Jul 14, 2009 at 07:43:29PM -0000, Joe Coffey wrote:
> > Thanks for your quick reply. However, this didn't fix it for me:
>
> > Basically if I have a file tester.py of the form:
>
> > from future import division, absolute_import
>
> > print "hi"
>
> Ha, OK. Sorry, I hadn't understood your problem.
>
> Sorry, I cannot fix this: the problem is that you cannot do imports from
> __future__ unless you are right at the entry point. In other word, you
> have to comment out or to try/except these lines. I can't fix this, and
> you won't be able to run these files in another program, say an IDE. It
> is a limitation of Python.
>
> Gaël
>
> --
> from future import ...
> https://bugs.launchpad.net/bugs/399106
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in pyreport: generate reports out of python scripts: New
>
> Bug description:
> Pyreport seems like a great piece of software. Unfortunately a fair amount
> of my groups modules are loaded by an importer that prepends:
>
> from __future__ import division, absolute_import
>
> before the module. This seems to make using pyreport impossible. Is there
> anyway out? Removing from future import from the modules isn't an option. I
> don't have control over the codebase.
>

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.