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

mikeio.read_pfs fail to parse PFS file when File name contains comma #763

Open
zhangr4 opened this issue Dec 3, 2024 · 4 comments · May be fixed by #793
Open

mikeio.read_pfs fail to parse PFS file when File name contains comma #763

zhangr4 opened this issue Dec 3, 2024 · 4 comments · May be fixed by #793
Labels

Comments

@zhangr4
Copy link

zhangr4 commented Dec 3, 2024

Describe the bug
PFS file, File name is delimited by a bar: |filename|.

When File name contains comma, mikeio.read_pfs fail to parse PFS file with error message

yaml.scanner.ScannerError: while scanning for the next token
found character '|' that cannot start any token

To Reproduce
Here is a simplified example PFS file, create a PFS file and use mikeio.read_pfs read the file

[MIKE_ZERO_PLOT_COMPOSER]
   [ACTIVE_X_PLOT]
      [PLOT_PROPERTIES]
         [Files]
            Number = 1
            [DataFile]
               DataFileName = |C:\the path,to\test.dfs2|
            EndSect  // DataFile

         EndSect  // Files

      EndSect  // PLOT_PROPERTIES

   EndSect  // ACTIVE_X_PLOT

EndSect  // MIKE_ZERO_PLOT_COMPOSER

Expected behavior

  • mikeio.read_pfs method could correctly parse file name.
  • Could the error message more clearly? Presently, the error seems throw from yaml scanner and indicate that '|' is not a start token, it takes me more time to locate the error comes from ',' instead of '|'.

Screenshots
image

System information:

  • Python version: python 3.13.0
  • MIKE IO version: mikeio 2.2.0
@zhangr4 zhangr4 changed the title "mikeio.read_pfs" fail to parse PFS file when File name contains comma mikeio.read_pfs fail to parse PFS file when File name contains comma Dec 3, 2024
@jsmariegaard
Copy link
Member

I guess this is the same as #475

@zhangr4
Copy link
Author

zhangr4 commented Dec 3, 2024

oh, yes, it is the same, shall I just close this issue? And btw, is there any plan to fix it?

@ecomodeller ecomodeller added the pfs label Feb 6, 2025
@jsmariegaard
Copy link
Member

@ecomodeller, is this now fixed with #782 ?

@ecomodeller
Copy link
Member

No, I forgot to take | into account. It only works for strings in single quotes.

Image

@ecomodeller ecomodeller linked a pull request Feb 11, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants