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

unit.get_loc() is throwing an error #5

Open
lebhero opened this issue Nov 9, 2022 · 4 comments
Open

unit.get_loc() is throwing an error #5

lebhero opened this issue Nov 9, 2022 · 4 comments

Comments

@lebhero
Copy link

lebhero commented Nov 9, 2022

Hi Everyone,

i am using the project.xml provided in the examples and trying to print the unit.get_loc():
from the https://github.com/srcML/pylibsrcml/tree/main/examples/srcml_read_archive_full:

...
while unit != None :
    # Can inquire about the current unit
    language = unit.get_language()
    filename = unit.get_filename()
    print(language, filename, unit.get_loc())
...

and receiving the following error:

...
in check_return
    raise srcMLException("Recieved invalid return status: " + str(value))
pylibsrcml.exception.srcMLException: Recieved invalid return status: 6
...

There is no method like set_loc(), as for filename or language..

Any help here is really appreciated.

Thanks

@lebhero lebhero changed the title get_loc is always returning -1 get_loc is throwing an error Nov 9, 2022
@lebhero lebhero changed the title get_loc is throwing an error unit.get_loc() is throwing an error Nov 9, 2022
@mjdecker
Copy link

mjdecker commented Nov 9, 2022

What version of srcML are you using?

@lebhero
Copy link
Author

lebhero commented Nov 9, 2022

srcml 1.0.0
libsrcml 1.0.0
libarchive 3.6.0

@Joshua2000B
Copy link
Member

Hello @lebhero

The issue is caused by an unnecessary exception check on the get_loc(). get_loc() is returning 6, the correct value, but due to the extraneous error check it is flagging as a srcML Exception.

We are currently working on fixing issues like this, as well as add some missing features. A temporary solution would be to go to the srcml_unit.py file and remove the call to check_return in the get_loc function, around line 364.

Let me know if this temporary fix works!

@lebhero
Copy link
Author

lebhero commented Nov 10, 2022

Hello @Joshua2000B : Yes, it did fix the issue, thank you...
Hope the next release will be out soon... :)
thank you again

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

3 participants