rubber crashing on file.close()

Bug #736183 reported by Davide Gerbaudo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Rubber
Fix Released
Medium
Unassigned

Bug Description

Hi

  Working on 2.6.35-gentoo-r12, python 2.6.6, dev-tex/rubber-1.1_p20090819.
Rubber is crashing on a simple tex example with the following error

$ rubber test_document
Traceback (most recent call last):
  File "/usr/bin/rubber", line 4, in <module>
    sys.exit(Main()(sys.argv[1:]))
  File "/usr/lib/python2.6/site-packages/rubber/cmdline.py", line 319, in __call__
    return self.main(cmdline)
  File "/usr/lib/python2.6/site-packages/rubber/cmdline.py", line 247, in main
    env.main.parse()
  File "/usr/lib/python2.6/site-packages/rubber/converters/latex.py", line 714, in parse
    self.process(self.source())
  File "/usr/lib/python2.6/site-packages/rubber/converters/latex.py", line 767, in process
    self.parse_file(file)
  File "/usr/lib/python2.6/site-packages/rubber/converters/latex.py", line 745, in parse_file
    function(self.vars, *args)
  File "/usr/lib/python2.6/site-packages/rubber/converters/latex.py", line 1057, in h_usepackage
    self.modules.register(name, dict)
  File "/usr/lib/python2.6/site-packages/rubber/converters/latex.py", line 79, in register
    file.close()
AttributeError: 'NoneType' object has no attribute 'close'

The problem is fixed with the attached patch.

Thanks

davide

Revision history for this message
Davide Gerbaudo (davide-gerbaudo) wrote :
Revision history for this message
oscar (garcia-unbc) wrote :

I was getting the same error from the gedit LaTeX Plugin, in Ubuntu Lucid (10.04). Apparently there is no file latex.py in my file system. I found that it was caused by the extra trailing comma in " "\usepackage{amsmath,bm,}". Removing the comma fixed the problem.

Revision history for this message
Eduardo Mucelli Rezende Oliveira (eduardo-mucelli) wrote :

This happens when you have linebreaks between the parameters and the package, e.g.,:

% Next 'usepackage' triggers the bug on rubber
\usepackage[a4paper, portuguese]
{hyperref}

% Next 'usepackage' does not trigger the bug on rubber
\usepackage[a4paper, portuguese]{hyperref}

Revision history for this message
Sebastian Kapfer (caci) wrote :

Actually is an oversight in the TeX parser. I committed a more radical fix which should be able to handle line breaks in \usepackage and other things. Please test!

Changed in rubber:
importance: Undecided → Medium
milestone: none → 1.2
status: New → Fix Committed
Sebastian Kapfer (caci)
Changed in rubber:
milestone: 1.2 → none
status: Fix Committed → Fix Released
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.