Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-53837

PDF conversion in new assignment grading interface does not work on windows servers

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.1
    • 3.1
    • Assignment
    • Windows Server 2008r2
      PHP 5.6.8
    • Any
    • MOODLE_31_STABLE
    • MOODLE_31_STABLE
    • m31_MDL-53837_Is_Executable_Python_Script_Windows
    • Hide
      1. Using our Win10-AllDrivers VM, download and install OpenOffice.
      2. Download unoconv zip, and extract it to c:\unoconv
      3. Download and install ghostscript I suggest: c:\gs
      4. Create a unoconv.bat file, add the content below and save it on c:\unoconv

        echo off
        REM unoconv.bat
        cd "C:\unoconv"
        "c:\Program Files\LibreOffice 5\program\python-core-3.3.0\bin\python.exe" unoconv.py %*
        

      5. That VM already has integration branch on c:\xampp\htdocs\integration, update and upgrade it.
      6. Log in as admin.
      7. Go to Site administration ► Server ► System paths
      8. Set pathtogs setting to your ghostscript installation binary, if you followed my suggestion C:\gs\bin\gswin32.exe
      9. Set pathtounoconv setting to your unoconv folder, if you followed my suggestion c:\unoconv\unoconv.bat
      10. Create a course and few users and enrol them.
      11. Create few docs using the open office and submit them (can be as admin).
      12. Go to the new assignment grade page.
      13. It should convert the doc file and display correctly.
      14. You should be able to add marks and comments on the pdf.
      15. Switch to another user on the assignment interface.
      16. It should generate the file correctly and you should be able to add marks and comments on the file.
      Show
      Using our Win10-AllDrivers VM, download and install OpenOffice . Download unoconv zip, and extract it to c:\unoconv https://github.com/dagwieers/unoconv/archive/master.zip Rename the unoconv file to unoconv.py Download and install ghostscript I suggest: c:\gs https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs919/gs919w32.exe Create a unoconv.bat file, add the content below and save it on c:\unoconv echo off REM unoconv.bat cd "C:\unoconv" "c:\Program Files\LibreOffice 5\program\python-core-3.3.0\bin\python.exe" unoconv.py %* That VM already has integration branch on c:\xampp\htdocs\integration , update and upgrade it. Log in as admin. Go to Site administration ► Server ► System paths Set pathtogs setting to your ghostscript installation binary, if you followed my suggestion C:\gs\bin\gswin32.exe Set pathtounoconv setting to your unoconv folder, if you followed my suggestion c:\unoconv\unoconv.bat Create a course and few users and enrol them. Create few docs using the open office and submit them (can be as admin). Go to the new assignment grade page. It should convert the doc file and display correctly. You should be able to add marks and comments on the pdf. Switch to another user on the assignment interface. It should generate the file correctly and you should be able to add marks and comments on the file.

      The new grading interface for mod assign in 3.1 looks great, but the conversion of files to PDF doesn't work on windows servers.

      This is because we are trying to execute a python script from PHP. According to PHP bug #41062 (https://bugs.php.net/bug.php?id=41062) the function is_executable will only return true for files ending in exe, com, bat, or cmd. Since unoconv is a python script (.py) the executable checks here:

      https://github.com/moodle/moodle/blob/master/admin/settings/server.php#L15
      (due to the is_executable call here:
      https://github.com/moodle/moodle/blob/master/lib/adminlib.php#L2548)

      and here
      https://github.com/moodle/moodle/blob/master/lib/filestorage/file_storage.php#L227
      will always return false preventing any document from being converted

            Unassigned Unassigned
            sbourget Stephen Bourget
            Simey Lameze Simey Lameze
            Andrew Lyons Andrew Lyons
            cameron1729 cameron1729
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.