<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: After upgrading mac os to High Sierra, using python3.6 sqlanydb in flask app gives error: Could not load dbcapi in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/after-upgrading-mac-os-to-high-sierra-using-python3-6-sqlanydb-in-flask-app/qaa-p/13846154#M4876997</link>
    <description>&lt;P&gt;I'm posting this as a solution because it at least solves my current problem. However, I think this is worth looking into more, and I'll be taking this problem to the Flask contributors.&lt;/P&gt;
&lt;P&gt;It seems that when I run flask the following way, I get all of the errors that I have mentioned.&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;export FLASK_APP=modules
export FLASK_DEBUG=1
flask run&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;This seems to wipe out the added key: &lt;CODE&gt;$DYLD_LIBRARY_PATH&lt;/CODE&gt;. However, when starting flask the following way, by calling app.run(), the key is not wiped out and sqlanydb is able to correctly locate the library files.&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;from myapp import app&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;if __name__== '__main__':
    app.run(debug=True)&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;If anyone on this forum has an explanation for what I'm seeing, I'm all ears. This is all very confusing. Again, everything worked just fine until I upgraded to High Sierra, so I suspect that must have some part to play.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2018 14:48:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2018-02-22T14:48:15Z</dc:date>
    <item>
      <title>After upgrading mac os to High Sierra, using python3.6 sqlanydb in flask app gives error: Could not load dbcapi</title>
      <link>https://community.sap.com/t5/technology-q-a/after-upgrading-mac-os-to-high-sierra-using-python3-6-sqlanydb-in-flask-app/qaq-p/13846153</link>
      <description>&lt;P&gt;I recently upgraded my OS to High Sierra, and since then I have not been able to use the sqlanydb library with my flask app. I was using SQLAnywhere16 and recently upgraded to SQLAnywhere17 after reading that it might solve problem, but it did not.&lt;/P&gt;
&lt;P&gt;I start by sourcing sa_config.sh located at /Applications/SQLAnywhere17/System/bin64/sa_config.sh. Then I run my flask app. In the initialization of my app, I create a connection using sqlanydb.connect(), and I am met with the following traceback.&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;File "/usr/local/lib/python3.6/site-packages/lib/python/site-packages/sqlanydb.py", line 522, in connect
  return Connection(args, kwargs)
File "/usr/local/lib/python3.6/site-packages/lib/python/site-packages/sqlanydb.py", line 538, in __init__
  parent = Connection.cls_parent = Root("PYTHON")
File "/usr/local/lib/python3.6/site-packages/lib/python/site-packages/sqlanydb.py", line 464, in __init__
  'libdbcapi_r.dylib')
File "/usr/local/lib/python3.6/site-packages/lib/python/site-packages/sqlanydb.py", line 456, in load_library
  raise InterfaceError("Could not load dbcapi.  Tried: " + ','.join(map(str, names)))
sqlanydb.InterfaceError: (u'Could not load dbcapi.  Tried: None,dbcapi.dll,libdbcapi_r.so,libdbcapi_r.dylib', 0)&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;When I run the python3.6 interpreter, I am able to import the sqlanydb and connect to my database just fine, with no error. But when I try to connect inside my flask app, I get this error.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 18:29:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/after-upgrading-mac-os-to-high-sierra-using-python3-6-sqlanydb-in-flask-app/qaq-p/13846153</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-02-21T18:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: After upgrading mac os to High Sierra, using python3.6 sqlanydb in flask app gives error: Could not load dbcapi</title>
      <link>https://community.sap.com/t5/technology-q-a/after-upgrading-mac-os-to-high-sierra-using-python3-6-sqlanydb-in-flask-app/qaa-p/13846156#M4876999</link>
      <description>&lt;P&gt;Update.&lt;/P&gt;
&lt;P&gt;When I open a python interpreter, or just run a plain python script, I added these lines to make sure that sourcing sa_config.sh was definitely adding the paths to my environment.&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;print(os.environ['PATH'])
print(os.environ['NODE_PATH'])
print(os.environ['DYLD_LIBRARY_PATH'])&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;Running those lines in the python interpreter or in a plain python script, it prints out the correct paths. However, when I added those three lines to just above the line where my flask app was breaking, it prints out the correct paths for the first two, but a key error is raised on $DYLD_LIBRARY_PATH. Apparently flask is unable to see the library path added by sa_config.sh. When I run &lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;echo $DYLD_LIBRARY_PATH&lt;/CODE&gt; &lt;/P&gt;
&lt;P&gt;in a terminal, it prints the path just fine. So then is flask not using the right environment? Why is flask unable to see the updated library path?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 14:15:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/after-upgrading-mac-os-to-high-sierra-using-python3-6-sqlanydb-in-flask-app/qaa-p/13846156#M4876999</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-02-22T14:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: After upgrading mac os to High Sierra, using python3.6 sqlanydb in flask app gives error: Could not load dbcapi</title>
      <link>https://community.sap.com/t5/technology-q-a/after-upgrading-mac-os-to-high-sierra-using-python3-6-sqlanydb-in-flask-app/qaa-p/13846154#M4876997</link>
      <description>&lt;P&gt;I'm posting this as a solution because it at least solves my current problem. However, I think this is worth looking into more, and I'll be taking this problem to the Flask contributors.&lt;/P&gt;
&lt;P&gt;It seems that when I run flask the following way, I get all of the errors that I have mentioned.&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;export FLASK_APP=modules
export FLASK_DEBUG=1
flask run&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;This seems to wipe out the added key: &lt;CODE&gt;$DYLD_LIBRARY_PATH&lt;/CODE&gt;. However, when starting flask the following way, by calling app.run(), the key is not wiped out and sqlanydb is able to correctly locate the library files.&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;from myapp import app&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;if __name__== '__main__':
    app.run(debug=True)&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;If anyone on this forum has an explanation for what I'm seeing, I'm all ears. This is all very confusing. Again, everything worked just fine until I upgraded to High Sierra, so I suspect that must have some part to play.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 14:48:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/after-upgrading-mac-os-to-high-sierra-using-python3-6-sqlanydb-in-flask-app/qaa-p/13846154#M4876997</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-02-22T14:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: After upgrading mac os to High Sierra, using python3.6 sqlanydb in flask app gives error: Could not load dbcapi</title>
      <link>https://community.sap.com/t5/technology-q-a/after-upgrading-mac-os-to-high-sierra-using-python3-6-sqlanydb-in-flask-app/qaa-p/13846155#M4876998</link>
      <description>&lt;P&gt;High Sierra will "purge" DYLD_LIBRARY_PATH now for protected processes - see &lt;A href="https://developer.apple.com/library/content/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html#//apple_ref/doc/uid/TP40016462-CH3-SW1"&gt;the docs from Apple&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 08:52:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/after-upgrading-mac-os-to-high-sierra-using-python3-6-sqlanydb-in-flask-app/qaa-p/13846155#M4876998</guid>
      <dc:creator>jeff_albion</dc:creator>
      <dc:date>2018-02-23T08:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: After upgrading mac os to High Sierra, using python3.6 sqlanydb in flask app gives error: Could not load dbcapi</title>
      <link>https://community.sap.com/t5/technology-q-a/after-upgrading-mac-os-to-high-sierra-using-python3-6-sqlanydb-in-flask-app/qaa-p/13846157#M4877000</link>
      <description>&lt;P&gt;Ah, I see. Thank you for pointing me in the right direction.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 16:06:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/after-upgrading-mac-os-to-high-sierra-using-python3-6-sqlanydb-in-flask-app/qaa-p/13846157#M4877000</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-02-23T16:06:14Z</dc:date>
    </item>
  </channel>
</rss>

