Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Unable to convert DCP files to XML using dcpTool on a Windows system

Explorer ,
Jul 24, 2023 Jul 24, 2023

Errors:

  • "*** Error: Unable to open file ***"
  • "*** Exception thrown in main routine - probably could not access a file"

 

What we've tried:

1. Checked if the DCP files and their paths are correct. The files do exist and are in the correct path.
2. Tried to run the script from different locations, including running the script from the directory where the DCP files are located.
3. Made sure the dcpTool and its DLL files are in the correct folder. Initially, they were in the Cygwin directory, but later moved to C:\Program Files\dcpTool.
4. Modified the shell script (originally written for ZSH) to a Windows batch file to ensure compatibility.
5. Checked the DCP file and output XML file paths in the script to ensure they are correct and tried using both relative and absolute paths.
6. Tested the command directly in the command line to rule out any issues with the script itself.
7. Checked the dcpTool command and arguments to ensure they are correct.
8. Checked if there were any permissions issues by running the batch file as an administrator.
9. Checked the batch script syntax and added error checking and logging to get more detailed output.

We haven't yet been able to solve the problem, hence reaching out for further help. Any advice would be greatly appreciated.

 

Thanks!


dcp2xml.sh

#!/usr/bin/env zsh

setopt extendedglob

script_dir=${0:A:h}

for dcp_file in $script_dir/**/*.dcp(N); do
  if [[ -f "$dcp_file" ]]; then
    echo "DCP file found: $dcp_file"

    # Convert the Cygwin-style path back to a Windows-style path manually
    win_dcp_file=$(cygpath -w $dcp_file)

    filename=$(basename "$dcp_file" .dcp)
    xml_file="${dcp_file:r}.xml"

    # Convert the Cygwin-style path for the XML file back to a Windows-style path manually
    win_xml_file=$(cygpath -w $xml_file)

    echo "Attempting to convert $win_dcp_file to $win_xml_file..."
    
    if ! dcptool decompile "$win_dcp_file" "$win_xml_file"; then
      echo "Error converting $win_dcp_file to $win_xml_file"
    else
      echo "Converted: $win_dcp_file -> $win_xml_file"
    fi
  fi
done


dcp2xml.bat

@echo off
setlocal enabledelayedexpansion

REM This is a comment
:: This is also a comment

set "script_dir=%~dp0"
set "dcptool_dir=C:\Program Files\dcpTool"

REM Loop through all .dcp files in the script directory
for /r "%script_dir%" %%F in (*.dcp) do (
  set "dcp_file=%%~fF"
  set "xml_file=%%~dpnF.xml"
  
  echo DCP file found: !dcp_file!
  echo Attempting to convert !dcp_file! to !xml_file!...
  
  REM Call dcpTool to convert the DCP file to an XML file
  "%dcptool_dir%\dcpTool.exe" decompile "!dcp_file!" "!xml_file!"
  
  REM If there was an error converting the file, pause and then exit with an error code
  if errorlevel 1 (
    echo Error converting !dcp_file! to !xml_file!
    pause
    exit /b 1
  ) else (
    echo Successfully converted !dcp_file! to !xml_file!
  )
)

 

TOPICS
Experiment , Windows
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 24, 2023 Jul 24, 2023
LATEST

What does this have to do with LightRoom?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines