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

importModel() randomly failing if path contains non-ASCII characters #562

Closed
edkerk opened this issue Oct 2, 2024 Discussed in #561 · 9 comments
Closed

importModel() randomly failing if path contains non-ASCII characters #562

edkerk opened this issue Oct 2, 2024 Discussed in #561 · 9 comments
Labels
bug Bug that needs fixing. fixed in develop This issue is fixed and pushed to develop branch. Will be closed when fix appears in master branch.

Comments

@edkerk
Copy link
Member

edkerk commented Oct 2, 2024

Discussed in #561

Originally posted by JBiaggi October 2, 2024
Hello! I recently reinstalled RAVEN using MATLAB (2024b) Add-Ons. Ever since I'm having this problem with importModel(): sometimes it works, sometimes it doesn't. Usually what happens is: when I run the code for the first time, I get this error message:

importModel('iYali.xml')
No model returned.

Error using dispEM (line 49)
There is a problem with the SBML file. Try using the SBML Validator at http://sbml.org/Facilities/Validator


Error in importModel (line 136)
    dispEM(EM);

Then I run the code again, and the function works! The SBML Validators reports that everything is fine with the model. Could you help me fix this problem somehow?

Kind regards

@edkerk edkerk added the bug Bug that needs fixing. label Oct 2, 2024
@edkerk
Copy link
Member Author

edkerk commented Oct 2, 2024

I encountered a similar issue in the last few days, where it also appears random when importModel works and when it doesn't. Although in my case it often works the first time, but not the second and later times, until it randomly seems to work again.

In my case, it seems to only occur for files that are in a shared OneDrive folder (not my own folder, example path: C:\Users\eduard\*University name*\*Other user* - *folder name*\ ). The spaces in the path don't seem to be the problem, because then it should never work, and not randomly. When I copy-paste the same file outsite the OneDrive-tracked folder, it seems to function fine (but this could of course also be random).

What happens if you run dbstop in importModel at 133 before running importModel, and when the function halts next time you run: [modelSBML,tmp] = TranslateSBML_RAVEN(fileName,0,0,[1 1]); tmp.message? The output I get is File unreadable., which I haven't figured out yet what it exactly means, but the problem does seem to come from libSBML.

I run MATLAB 2024a, with RAVEN installed via Git, on a Windows 10 computer.

@edkerk
Copy link
Member Author

edkerk commented Oct 2, 2024

I think it has something to do with having Unicode characters in the path or filename, see here.

I have this bug when the file is located in a folder named tåst/, but not when located in a folder named test/. I don't know how to resolve this. @JBiaggi Does this also explain your case?

@JBiaggi
Copy link

JBiaggi commented Oct 3, 2024

The files I'm having problem with are also in a One Drive folder. The folder name is OneDrive - Tallinna Tehnikaülikool so maybe the 'ü' in the university's name may be causing the Unicode filename issue. I moved the same model file to another location where it doesn't have any special characters, ran importModel() three times, and it worked every time.

@edkerk edkerk changed the title importModel() randomly failing importModel() randomly failing if path contains non-ASCII characters Oct 3, 2024
@edkerk
Copy link
Member Author

edkerk commented Oct 3, 2024

It is odd that this seems to happen at random. I checked the string that MATLAB is parsing to libSBML in both successful and failing cases, and it was identical (as one would expect).

The only solution I can then think of is to have the SBML file first copied to a temporary folder (if the source folder has non-ASCII characters), before calling libSBML. Something similar is done in getBlast in cases where the path contains spaces.

@edkerk
Copy link
Member Author

edkerk commented Oct 3, 2024

If you run tempname, does the path that is returned contain any non-ASCII characters?

@edkerk
Copy link
Member Author

edkerk commented Oct 4, 2024

The workaround involving a temporary file is implemented as part of #559.

@edkerk edkerk added the fixed in develop This issue is fixed and pushed to develop branch. Will be closed when fix appears in master branch. label Oct 9, 2024
@mihai-sysbio
Copy link
Member

Alternatively, I would suggest the use of a symbolic link in Windows.

@JBiaggi
Copy link

JBiaggi commented Oct 11, 2024

If you run tempname, does the path that is returned contain any non-ASCII characters?

I don't know if I got exactly what you asked Ed, but here is what my tempname returned :

>> tempname('C:\Users\jusabe\OneDrive - Tallinna Tehnikaülikool')

ans =

    'C:\Users\jusabe\OneDrive - Tallinna Tehnikaülikool\tp52b512a6_9910_4020_813d_a17df0fb6fbf'

@edkerk
Copy link
Member Author

edkerk commented Oct 11, 2024

Yes, it indeed contains ü, which is not an ASCII character. The current develop version of RAVEN should have this fixed.

@edkerk edkerk closed this as completed Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that needs fixing. fixed in develop This issue is fixed and pushed to develop branch. Will be closed when fix appears in master branch.
Projects
None yet
Development

No branches or pull requests

3 participants