Jump to content
Sign in to follow this  
narkotik

Ortools Import Error

Recommended Posts

Posted (edited)

 

Hi, i did google ortools install. The code works fine with pycharm. I'm getting an error with pyscripter, can you help?

from ortools.constraint_solver import routing_enums_pb2
from ortools.constraint_solver import pywrapcp
search_parameters = pywrapcp.DefaultRoutingSearchParameters()

First Run Error:

Invalid floating point operation.

 

Second Run ++ Error :

Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "C:\Users\narkotik\AppData\Roaming\Python\Python39\site-packages\ortools\constraint_solver\pywrapcp.py", line 2828, in DefaultRoutingSearchParameters
    return _pywrapcp.DefaultRoutingSearchParameters()
  File "C:\Users\narkotik\AppData\Roaming\Python\Python39\site-packages\ortools\constraint_solver\routing_parameters_pb2.py", line 8, in <module>
    from google.protobuf import symbol_database as _symbol_database
  File "C:\Users\narkotik\AppData\Local\Programs\Python\Python39\lib\site-packages\google\protobuf\symbol_database.py", line 66, in <module>
    class SymbolDatabase(message_factory.MessageFactory):
AttributeError: partially initialized module 'google.protobuf.message_factory' has no attribute 'MessageFactory' (most likely due to a circular import)

 

Edited by narkotik

Share this post


Link to post

Problem solved.

procedure TForm1.PythonEngine1BeforeLoad(Sender: TObject);
begin
  MaskFPUExceptions(True);
end;

 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×