I'm developing an html scraper and I want to write and rewrite the data obtained to a .db file using sqlanydb. I'm using Python3 and I've already downloaded SQL Anywhere 12. Importing sqlanydb library seems to work properly, but as soon as I implement the .connect(...) method the following error arises always, no matter on which path I specify the database: File "example.py", line 30, in
File "/usr/local/lib/python3.5/site-packages/sqlanydb.py", line 512, in connect
File "/usr/local/lib/python3.5/site-packages/sqlanydb.py", line 528, in init
File "/usr/local/lib/python3.5/site-packages/sqlanydb.py", line 454, in init
File "/usr/local/lib/python3.5/site-packages/sqlanydb.py", line 446, in load_library
TypeError: sequence item 0: expected str instance, NoneType found Could please anyone help me out with this? Thank you. asked 16 Feb '16, 06:22 pere93 Volker Barth |
Volker is correct. Graeme's answer was the final answer but it was a little hard to find (without showing all responses) ... so I promoted it to an answer. The gist of this is that various BDS/Unix/Linux/OSX shells have their own way to "source" (yes, the word 'source' is a verb and a command in Unix/Posix/BSD shells) so that cmd has to be supplied as a separate token. For Bash and Bourne
and for some other shells related to the 'C'-shell (csh) the source cmd is the word
I beleive the default for Mac OSX is the Bash shell so I would start by trying the first example; with a space. answered 16 Feb '16, 15:36 Nick Elson S... 1
Okay guys, I solved it. The problem finally was that the sa_config.csh script was left to execute. Once you execute both {.sh.csh} scripts, your environment is settled up properly and thus able to find every library on the SQLAnywhere platform. Thank you Nick and Volker for your answers!
(17 Feb '16, 06:49)
pere93
|
Knowing which platform you are running this on will help. Also knowing what exactly you downloaded (and installed) may be important too.
If running on Linux or one of the Unix platforms, you'll need to set up your environment before launching Python. On those platforms you will need to source the sa_config{.sh|.csh} script so your Python application can locate the required libraries (including libdbcapi12.dll).
Of course, sorry. I'm running on a Mac OS X. I installed python3 along with the sqlanydb library, and downloaded SQL Anywhere 12.
I read somewhere about to run the sa_config.sh script by running ./Applications/SQLAnywhere12/System/bin32/sa_config.sh, or, anternatively, add SQLAnywhere/System/lib32 to the DYLD_LIBRARY_PATH which make the environment able to locate the libraries. I tried both but it still doesn't work, or perhaps I did it incorrectly....
What do you mean by setting up my environment before launching Python? Do you mean running the sa_config script before running my py file? I'm a bit lost so I will really appreciate a tutorial or at least a key guideline which could help me out fixing this.
Thank you.
I don't use Mac OS X, so I can't tell. But hopefully the following FAQ (or another one of those tagged with "macosx") is of help:
[http://sqlanywhere-forum.sap.com/questions/23704/python3-cannot-import-sqlanydb]