Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certain result documents are causing an error: "No such file or directory" #30

Closed
zhengzheli opened this issue Oct 11, 2023 · 3 comments

Comments

@zhengzheli
Copy link

Please see the below code to reproduce:

 dbc <- nodbi::src_mongo(collection = "test2", db = "db")
 q <- "https://www.clinicaltrialsregister.eu/ctr-search/search?query=2014-001203-50"
 ctrLoadQueryIntoDb(
   queryterm = q,
   con = dbc,
   euctrresults = TRUE,
   documents.path = "d",
   verbose = TRUE,
 )
  • Found search query from EUCTR: query=2014-001203-50
    Checking helper binaries: done
  • Checking trials in EUCTR...
    DEBUG: queryterm is https://www.clinicaltrialsregister.eu/ctr-search/search?query=2014-001203-50
    Retrieved overview, multiple records of 1 trial(s) from 1 page(s) to be downloaded (estimate: 0.05 MB)
    Created directory d
    (1/3) Downloading trials...
    Note: register server cannot compress data, transfer takes longer, about 0.5s per trial
    Download status: 1 done; 0 in progress. Total size: 26.00 Kb (100%)... done!
    (2/3) Converting to JSON, 1 records converted
    DEBUG: c:\cygwin\bin\bash.exe --noprofile --norc --noediting -c "PATH=/usr/local/bin:/usr/bin; "/cygdrive/C/Users/ES-PHI1/AppData/Local/R/WIN-LI1/4.2/ctrdata/exec/EUCTR21.SH" /cygdrive/C/Users/ES-PHI1/AppData/Local/Temp/RTMPKF1/CTRDAT4"
    (3/3) Importing JSON records into database...
    DEBUG: C:\Users\ES-Philip\AppData\Local\Temp\Rtmpkf8Xvs\ctrDATA4838515e7a2b
    = Imported or updated 1 records on 1 trial(s)
  • Checking results if available from EUCTR for 1 trials:
    (1/4) Downloading and extracting results (. = data, F = file[s] and data, x = none):
    Download status: 1 done; 0 in progress. Total size: 992.96 Kb (100%)... done!
    Error in utils::unzip(zipfile = f, exdir = tempDir) :
    cannot open file 'C:/Users/ES-Philip/AppData/Local/Temp/Rtmpkf8Xvs/ctrDATA4838515e7a2b/Cartier.2019.Repeated Full-Face Aesthetic Combination Treatment With AbobotulinumtoxinA, Hyaluronic Acid Filler, and Skin-Boosting Hyaluronic Acid After Monotherapy With AbobotulinumtoxinA or Hyaluronic Acid Filler.pdf': No such file or directory

I believe it is related to this code in main.R

          tmp <- utils::unzip(
            zipfile = f,
            exdir = tempDir)
          if (is.null(tmp)) return(NULL)
@rfhb
Copy link
Owner

rfhb commented Oct 11, 2023

  • Thank you for reporting the issue. This is related to file names that are too long under / for MS Windows.
  • In R, run usethis::edit_r_environ() and add / edit to read, e.g. TMPDIR=c:/tmp in order to set R's directory for temporary files to a short pathname. Note this should be an absolute pathname and the folder should exist. Restart R before running the example above.
  • Code has been modified to to not error when extracting files and to better inform on subsequent errors (see https://github.com/rfhb/ctrdata/blob/master/R/main.R#L1707)
  • Try ctrdata 27d68d0 by running devtools::install_github("rfhb/ctrdata"), followed by the example above.

@zhengzheli
Copy link
Author

@rfhb Thank you for your quick response and fix! I can confirm it works now.

@rfhb rfhb closed this as completed Oct 12, 2023
@rfhb
Copy link
Owner

rfhb commented Mar 25, 2024

R 4.3 may permit much longer file path names, see https://blog.r-project.org/2023/03/07/path-length-limit-on-windows/index.html, hence the issue reported here may also be addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants