EPrints Technical Mailing List Archive

Message: #05232


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Re: undefined value error


Sadly not - edit_lock_until = 0  (edit_lock_user=3369, edit_lock_since=1395308316 - 20 March 2014)

It *might* be due to some dubious or missing data in another table??  It just seems odd that I've pulled the eprint from the repository, can access the fields, can call set_value on fields and then, on some records only, it loses the eprint object somewhere between the call to 'commit' and the BackCompatibility function...


-----Original Message-----
From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of John Salter
Sent: 03 December 2015 12:35
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: undefined value error

Is the record locked for editing by another user?

-----Original Message-----
From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Alan.Stiles
Sent: 03 December 2015 12:27
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: undefined value error

Interesting, maybe...

It worked fine (once I amended the #! to use /opt/eprints3/perl_lib ) and set title to "a value" on eprint 1.  I changed it to set new_field_name and that worked fine too.
I then changed it to set the same field and value on eprint 31252 (where my routine currently falls over) and it falls over with the same message.  As it does if I try and set "title" on that eprint.  So it looks to be record specific.



-----Original Message-----
From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Field A.N.
Sent: 03 December 2015 11:57
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: undefined value error

Not seen this before.  Does this script work:


#!/usr/bin/perl -I/usr/share/eprints3/perl_lib

use strict;
use warnings;

use EPrints;

my $ep = EPrints->new();
my $repo = $ep->repository( "myrepository" ); my $eprint = $repo->eprint( 1 ); $eprint->set_value ("title", "a value"); $eprint->commit;

I test-ran it on a 3.3.12 repository, and it worked.  First run as above, and then change the set_value line to use the new field.


--
Adam Field
Business Relationship Manager and Community Lead EPrints Services
+44 (0)23 8059 8814




On 3 Dec 2015, at 11:43, Alan.Stiles wrote:

> Has anyone seen / solved an issue like this?
>
> I'm building a command-line routine (in 3.3.10) to update a new field on eprints. The field exists in the dataset, as seen in MySQL workbench.
> It works fine for most of the eprints I'm updating, but some of them cause the routine to fail with the following message:
>
> Can't call method "current_repository" on an undefined value at /opt/eprints3/perl_lib/EPrints/BackCompatibility.pm line 443.
>
>
> My raft of debug statements have narrowed it down to a call to 
> $eprint->commit;
>
> ...
> my $eprint = $repository->eprint($eprint_id); if (defined($eprint)) { 
> $eprint->set_value ("new_field_name", "a value"); print STDERR "debug 
> 4, ".$eprint->get_value("new_field_name").", "; $eprint->commit ; 
> print STDERR "debug 5\n"; } ...
>
> And the output on STDERR is
>
> debug 4, a value, Can't call method "current_repository" on an undefined value at /opt/eprints3/perl_lib/EPrints/BackCompatibility.pm line 443.
>
> Any clues?  This is on a dev server, so something might be missing from another table?  Everything looks the same in the eprints table as records that worked.
> -- The Open University is incorporated by Royal Charter (RC 000391), 
> an exempt charity in England & Wales and a charity registered in 
> Scotland (SC 038302). The Open University is authorised and regulated 
> by the Financial Conduct Authority. *** Options:
> http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/
> *** EPrints developers Forum: http://forum.eprints.org/


*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/
-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University is authorised and regulated by the Financial Conduct Authority.

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/