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

'U' flag has been deprecated since Python 3.3 #15

Open
TobiasKAndersen opened this issue Oct 10, 2024 · 0 comments
Open

'U' flag has been deprecated since Python 3.3 #15

TobiasKAndersen opened this issue Oct 10, 2024 · 0 comments

Comments

@TobiasKAndersen
Copy link
Contributor

Hi,

I get this error message when trying to execute parsac in the Python 3.11.5:

(base) C:\Users\tkan>parsac calibration run C:\Users\tkan\Model_setups\lake_shahe_workshop\parsac\wet_dashahe-step1.xml
Reading configuration from C:\Users\tkan\Model_setups\lake_shahe_workshop\parsac\wet_dashahe-step1.xml...
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\tkan\AppData\Local\anaconda3\Scripts\parsac.exe\__main__.py", line 7, in <module>
  File "C:\Users\tkan\AppData\Local\anaconda3\Lib\site-packages\parsac\parsac_run.py", line 12, in main
    parsac.main()
  File "C:\Users\tkan\AppData\Local\anaconda3\Lib\site-packages\parsac\__init__.py", line 48, in main
    args.func(args)
  File "C:\Users\tkan\AppData\Local\anaconda3\Lib\site-packages\parsac\run.py", line 42, in main
    current_job = job.fromConfigurationFile(args.xmlfile, tempdir=args.tempdir, verbose=not args.quiet)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\tkan\AppData\Local\anaconda3\Lib\site-packages\parsac\job\__init__.py", line 31, in fromConfigurationFile
    return name2class[model_type](job_id, xml_tree, os.path.dirname(path), **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\tkan\AppData\Local\anaconda3\Lib\site-packages\parsac\job\gotm.py", line 14, in __init__
    program.Job.__init__(self, job_id, xml_tree, root, **kwargs)
  File "C:\Users\tkan\AppData\Local\anaconda3\Lib\site-packages\parsac\job\program.py", line 298, in __init__
    shared.Job.__init__(self, job_id, xml_tree, root)
  File "C:\Users\tkan\AppData\Local\anaconda3\Lib\site-packages\parsac\job\shared.py", line 184, in __init__
    self.parameters.append(self.getParameter(att))
                           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\tkan\AppData\Local\anaconda3\Lib\site-packages\parsac\job\program.py", line 360, in getParameter
    return YamlParameter(self, att)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\tkan\AppData\Local\anaconda3\Lib\site-packages\parsac\job\program.py", line 172, in __init__
    with io.open(os.path.join(job.scenariodir, self.file), 'rU', encoding='utf-8') as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid mode: 'rU'

From what I can read on the web, it seems U file mode was removed in Python 3.11 because it had no effect so the U can merely be removed.

If I change 'rU' in program.py and gotm.py, I do not get the error message and I can execute parsac calibration.

Cheers,

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

No branches or pull requests

1 participant