2
1
0

I am using windows and I get the following error: SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated \UXXXXXXXX escape

    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      Hi Lisa,

      Can you give more information on what file are you trying to read? In general this usually is caused you have special character in your input files that you are trying to read. 

      If you are opening that file in python, you can try to first specify what decoding you are trying to do; then you can set the ignores. For example: 

      with open(your_file_path, 'r', encoding='utf-8', errors="ignore") as f:
      ...
      1. Lisa Wang

        Hey Chen,

        I am trying to run Joplin cge model and use the command below:

        joplin_cge.set_parameter("solver_path", "C:\Users\lisawang\.conda\envs\pyincore\Library\bin\ipopt.exe")
        joplin_cge.set_parameter("model_iterations", 1)

        And it gave me this error:
        C:\Users\lisawang\.conda\envs\pyincore\python.exe C:/Users/lisawang/.conda/envs/pyincore/Lib/site-packages/pyincore/analyses/joplincgeanalysis/test_joplincgeanalysis.py
        File "C:/Users/lisawang/.conda/envs/pyincore/Lib/site-packages/pyincore/analyses/joplincgeanalysis/test_joplincgeanalysis.py", line 30
        joplin_cge.set_parameter("solver_path", "C:\Users\lisawang\.conda\envs\pyincore\Library\bin\ipopt.exe")
        ^
        SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
      2. Diego Rivera

        an easy way to solve this is to add an r in front of the string:

        joplin_cge.set_parameter("solver_path", r"C:\Users\lisawang\.conda\envs\pyincore\")
      CommentAdd your comment...