Skip to content

h5file() fails when run from an Rscript #64

@echomsky

Description

@echomsky

Many thanks for creating and maintaining this package.

It appears that the package is missing some symbols from methods. The following test script runs successfully from an interactive session (which loads methods by default), but fails when run from an Rscript:

#!/usr/bin/env Rscript
library('h5')
fxx <- h5file('test.h5', mode='w')
fxx['data'] <- 1:10
h5close(fxx)

The following error is reported:

Error in initialize(value, ...) :
  cannot use object of class “character” in new():  class “H5File” does not extend that class
Calls: h5file -> new -> initialize -> initialize
6: (function ()
   traceback(2))()
5: stop(gettextf("cannot use object of class %s in new():  class %s does not extend that class",
       dQuote(Classi), dQuote(Class)), domain = NA)
4: initialize(value, ...)
3: initialize(value, ...)
2: new("H5File", name, mode)
1: h5file("test.h5", mode = "w")

The Rscript runs successfully if methods is explicitly loaded before h5:

#!/usr/bin/env Rscript
library('methods')
library('h5')
fxx <- h5file('test.h5', mode='w')
fxx['data'] <- 1:10
h5close(fxx)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions