[Bioc-devel] Updating to Python 3: Problem with Importlib library

Martin Morgan mtmorg@n@b|oc @end|ng |rom gm@||@com
Thu Oct 1 18:40:27 CEST 2020


The script is currently in the root directory of the package

~/b/git$ ls seq2pathway/scripts/
Function_PeakMutationAnnotation_GENCODE_05182015.py
Function_PeakMutationAnnotation_GENCODE_08182020.py

but needs to be in inst/scripts folder like the earlier version

~/b/git$ ls seq2pathway/inst/scripts/
Function_PeakMutationAnnotation_GENCODE_05182015.py

This is because the code in the package is evaluated after it has been installed, and top-level files other than DESCRIPTION, etc., are not copied to the install location.

Do you check your package before pushing changes, 

  R CMD build seq2pathway
  R CMD check seq2pathway_<version>.tar.gz

?

Martin Morgan

On 10/1/20, 12:27 PM, "Bioc-devel on behalf of Yuxi Sun" <bioc-devel-bounces using r-project.org on behalf of ysun11 using uchicago.edu> wrote:

    Hi,

    I am writing on behalf of the development team for the package seq2pathway.
    After updating to python 3 and replacing the deprecated imp library with
    importlib library, we encountered the following problem.

    Our python code is included in the
    file Function_PeakMutationAnnotation_GENCODE_08182020 in the same folder.
    When I try to call the file by the following lines:

    sink(file.path(tempdir(),name,fsep = .Platform$file.sep))
    cat("from importlib.machinery import SourceFileLoader", sep="\n")
    cat("SourceFileLoader('Function_PeakMutationAnnotation_GENCODE_08182020',")
    cat("'", path, "').load_module()",sep="")

    it failed and reported the following error message:

    FileNotFoundError: [Errno 2] No such file or directory:
    '/private/var/folders/7d/jtfhkky940n_83bv32nyv_bm0000gn/T/RtmpZS8eqz/Rinst4fbc14010ad1/seq2pathway//scripts/Function_PeakMutationAnnotation_GENCODE_08182020.py'


    Would you please kindly instruct me how to fix this error?


    Thanks and regards,

    Jennifer

    	[[alternative HTML version deleted]]

    _______________________________________________
    Bioc-devel using r-project.org mailing list
    https://stat.ethz.ch/mailman/listinfo/bioc-devel


More information about the Bioc-devel mailing list