Opened 3 years ago

Closed 3 years ago

#487 closed defect (fixed)

refextract: improve argument check

Reported by: simko Owned by: chayward
Priority: minor Milestone:
Component: BibEdit Version:
Keywords: Cc:


When you run refextract on a non-existent file, it tracebacks with:

UnboundLocalError: local variable 'count_auth_group' referenced before assignment

It should check the parameters properly and report the concrete problem, e.g. file non-existent, permission denied, etc.

Change History (6)

comment:1 Changed 3 years ago by simko

  • Owner set to chayward
  • Status changed from new to assigned

comment:2 Changed 3 years ago by chayward

  • Status changed from assigned to in_merge

comment:3 Changed 3 years ago by chayward

on branch: refextract-countauth-fix

paired with support for arxiv file names

comment:4 Changed 3 years ago by simko

  • Status changed from in_merge to assigned

Running refextract on a non-existent file does not report an error for
me; it produces empty output:

/opt/invenio/bin/refextract 1:/tmp/nonexistentfile.pdf
<?xml version="1.0" encoding="UTF-8"?>
<collection xmlns="">
   <controlfield tag="001">1</controlfield>
   <datafield tag="999" ind1="C" ind2="6">
      <subfield code="a">Invenio/1.0.0-rc0.40-106ba refextract/1.0.0-rc0.40-106ba-1297762113-1-0-0-0-0-0-0</subfield>

It should print an error message and exit with some error code
so that clients can know something went wrong. (e.g. workflow can
halt etc)

comment:5 Changed 3 years ago by chayward

  • Status changed from assigned to in_merge

on branch: refextract-countauth-fix

comment:6 Changed 3 years ago by Christopher Hayward <christopher.james.hayward@…>

  • Resolution set to fixed
  • Status changed from in_merge to closed

In [3680959b3640bbe54a013e9c3bf50af0ff7a29bf]:

refextract: fix unassigned count_auth_group

  • Initialised count_auth_group in main. (closes #487)
  • Updated usage information with inspire journal title output option.
  • When obtaining the recid and the file location for each extraction job, split a maximum of one time, since file names with arvix notation regularly include a colon e.g. 'arxiv:9834.pdf'.
  • Display an error message, regardless of the output mode, and halt extraction when either a non-existent or an unreadable pdf/text input file is provided as input.
Note: See TracTickets for help on using tickets.