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

2 Swi-prolog version regex errors #71

Closed
prologrules opened this issue Nov 6, 2019 · 2 comments
Closed

2 Swi-prolog version regex errors #71

prologrules opened this issue Nov 6, 2019 · 2 comments

Comments

@prologrules
Copy link
Contributor

>>> from pyswip import Prolog
>>> prolog = Prolog()
>>> prolog.assertz("father(michael,john)")
Please enter you SWI-Prolog version in format "X.Y.Z": 8.1.15
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-12-629572b3dbd4> in <module>
----> 1 from pyswip import Prolog
      2 prolog = Prolog()
      3 prolog.assertz("father(michael,john)")

~/new_terminal_python/lib/python3.7/site-packages/pyswip/__init__.py in <module>
     27 __VERSION__ = "0.2.7"
     28 
---> 29 from pyswip.prolog import Prolog
     30 from pyswip.easy import *

~/new_terminal_python/lib/python3.7/site-packages/pyswip/prolog.py in <module>
     26 import sys
     27 
---> 28 from pyswip.core import *
     29 
     30 

~/new_terminal_python/lib/python3.7/site-packages/pyswip/core.py in <module>
    566 # Find the path and resource file. SWI_HOME_DIR shall be treated as a constant
    567 # by users of this module
--> 568 (_path, SWI_HOME_DIR) = _findSwipl()
    569 _fixWindowsPath(_path)
    570 

~/new_terminal_python/lib/python3.7/site-packages/pyswip/core.py in _findSwipl()
    418 
    419         if path is None:
--> 420             (path, swiHome) = _findSwiplMacOSHome()
    421 
    422     else:

~/new_terminal_python/lib/python3.7/site-packages/pyswip/core.py in _findSwiplMacOSHome()
    340             path = os.environ.get('PLBASE')
    341             if path is None:
--> 342                 swi_ver = get_swi_ver()
    343                 path = '/Applications/SWI-Prolog.app/Contents/swipl-' + swi_ver + '/lib/'
    344 

~/new_terminal_python/lib/python3.7/site-packages/pyswip/core.py in get_swi_ver()
    308     swi_ver = input(
    309                 'Please enter you SWI-Prolog version in format "X.Y.Z": ')
--> 310     match = re.search(r'[0-9]\.[0-9]\.[0-9]')
    311     if match is None:
    312         raise InputError('Error, type normal version')

TypeError: search() missing 1 required positional argument: 'string'

First error is this thing above, that the input has to be passed to the re.search as the second argument. Second error is that the regex needs to capture more than one digit on the version numbers with a + after each [0-9].

prologrules added a commit to prologrules/pyswip that referenced this issue Nov 6, 2019
Fixing version regex, issue 71 yuce#71
@prologrules
Copy link
Contributor Author

I wrote a fix for this and made a pull request: #72
@yuce

g-gemignani pushed a commit to magazino/pyswip that referenced this issue Jul 2, 2020
Fixing version regex, issue 71 yuce#71
@yuce
Copy link
Owner

yuce commented Oct 27, 2024

This issue should be fixed by the last version of PySwip.

@yuce yuce closed this as completed Oct 27, 2024
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