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

Unrecognized function or variable 'Schema'.[Bug]: #565

Closed
2 tasks done
amadaabrego opened this issue Mar 20, 2024 · 2 comments
Closed
2 tasks done

Unrecognized function or variable 'Schema'.[Bug]: #565

amadaabrego opened this issue Mar 20, 2024 · 2 comments

Comments

@amadaabrego
Copy link

What happened?

Hey everyone, whenever I'm generating a core I get the below error. I have tried to debug it myself, but I do not find anything wrong. The java_loc and nwb_loc folders/paths seem to be correct. So, I have no idea what might be going on. Could there be an error with the schema.jar file?

Before reading a file, I exported a couple of them, and I didn't have an issue with the code. I realized just now that it saved it in the 2.2.5 schema. I do not know why!

In javaclasspath
In javaclasspath
In javaaddpath (line 71)
In spec.loadSchemaObject (line 9)
In spec.generate (line 6)
In generateExtension (line 53)
In generateCore (line 52)
In spec.loadSchemaObject (line 9)
In spec.generate (line 6)
In generateExtension (line 53)
In generateCore (line 41)
In spec.loadSchemaObject (line 9)
In spec.generate (line 6)
In generateExtension (line 53)
In generateCore (line 52)
Unrecognized function or variable 'Schema'.

Steps to Reproduce

function schema = loadSchemaObject()
%LOADSCHEMAOBJECT Loads YAML reader from jar
%   Returns a Java object which can read() yaml text
try
    schema = Schema();
catch
    nwb_loc = fileparts(which('NwbFile'));
    java_loc = fullfile(nwb_loc, 'jar', 'schema.jar');
    javaaddpath(java_loc);
    schema = Schema();
end
end

Error Message

> In javaclasspath
In javaclasspath
In javaaddpath (line 71)
In spec.loadSchemaObject (line 9)
In spec.generate (line 6)
In generateExtension (line 53)
In generateCore (line 52)
In spec.loadSchemaObject (line 9)
In spec.generate (line 6)
In generateExtension (line 53)
In generateCore (line 41)
In spec.loadSchemaObject (line 9)
In spec.generate (line 6)
In generateExtension (line 53)
In generateCore (line 52) 
Unrecognized function or variable 'Schema'.

Operating System

macOS

Matlab Version

2023b

Code of Conduct

@lawrence-mbf
Copy link
Collaborator

Does the result of which spec.loadSchemaObject return what you expect it to? What version of MatNWB are you using? I am unable to recreate the issue and the CI should fail if schema.jar is corrupted.

Your issue with writing the wrong schema version may be a result of multiple MatNWB generated types on your MATLAB path. Check your path to see if you are referencing the correct MATLAB types with which. If you are writing, I would suggest calling nwbClearGenerated() and generateCore() to wipe any previously generated types before generating the types necessary.

@amadaabrego
Copy link
Author

That worked! Thanks.

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

2 participants