Code Monkey home page Code Monkey logo

Comments (12)

mnowotka avatar mnowotka commented on August 11, 2024

Hi Dezso,

Thanks for reporting this. It would be good to get some additional information before we proceed. Can you try to execute the import statement once again but this time add this BEFORE import:

import logging
logging.basicConfig()
logging.basicConfig(level=logging.DEBUG)

And paste the output here. Let's see what's going on...

from chembl_webresource_client.

medozz avatar medozz commented on August 11, 2024

Hi,

I got the same error message I hope you get the log. Code:
import logging logging.basicConfig() logging.basicConfig(level=logging.DEBUG) from chembl_webresource_client import *
Result:
Traceback (most recent call last): File "C:/Working_projects/Cancer_related_fristeighbours/Experimental_validation/Python_project/Search_for_chemble_data_for_compounds.py", line 10, in <module> from chembl_webresource_client import * File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\chembl_webresource_client\__init__.py", line 23, in <module> from chembl_webresource_client.utils import utils File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\chembl_webresource_client\utils.py", line 8, in <module> utils = client_from_url(Settings.Instance().utils_spore_url) File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\chembl_webresource_client\spore_client.py", line 17, in client_from_url schema = session.get(url).json() File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\requests\models.py", line 826, in json return complexjson.loads(self.text, **kwargs) File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\simplejson\__init__.py", line 516, in loads return _default_decoder.decode(s) File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\simplejson\decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

from chembl_webresource_client.

mnowotka avatar mnowotka commented on August 11, 2024

OK, then, can you do:

from chembl_webresource_client.settings import Settings
url = Settings.Instance().UTILS_SPORE_URL
print url

import requests
r = requests.get(url)
print r.status_code
print r.ok
print r.json()

And paste results?

from chembl_webresource_client.

medozz avatar medozz commented on August 11, 2024

Hi,

It gives the same results.
Code:
from chembl_webresource_client.settings import Settings
url = Settings.Instance().UTILS_SPORE_URL
print url
import requests
r = requests.get(url)
print r.status_code
print r.ok
print r.json()

Result:
Traceback (most recent call last): File "C:/Working_projects/Cancer_related_fristeighbours/Experimental_validation/Python_project/Search_for_chemble_data_for_compounds.py", line 6, in <module> from chembl_webresource_client.settings import Settings File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\chembl_webresource_client\__init__.py", line 23, in <module> from chembl_webresource_client.utils import utils File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\chembl_webresource_client\utils.py", line 8, in <module> utils = client_from_url(Settings.Instance().utils_spore_url) File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\chembl_webresource_client\spore_client.py", line 18, in client_from_url schema = session.get(url).json() File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\requests\models.py", line 826, in json return complexjson.loads(self.text, **kwargs) File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\simplejson\__init__.py", line 516, in loads return _default_decoder.decode(s) File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\simplejson\decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

from chembl_webresource_client.

mnowotka avatar mnowotka commented on August 11, 2024
  1. First of all there are some print statements in my code and I asked you to paste them so we can have a look.
  2. Secondly as you see you are getting an error although you are not using the client (strictly speaking you are using just one constant with the endpoint URL I asked you to print).

So either the URL is wrong (which I doubt) or you have some problems with internet connection. But I can say for sure because you did not include output of print statements.

from chembl_webresource_client.

medozz avatar medozz commented on August 11, 2024

Hi,

I can reach Chembl with a simple:
import urllib
f = urllib.urlopen("https://www.ebi.ac.uk/chembl/")
data = f.read()
print data > 0
from chembl_webresource_client.settings import Settings
Results:
True
But after that I get the same error message. I think it is because the data are feed by start to json. Could it be the encoding of any of the files? It can be my python as well, because mine is:
2.7.12 |Anaconda 2.5.0 (64-bit)| (default, Jun 29 2016, 11:07:13) [MSC v.1500 64 bit (AMD64)]
Sorry for the inconvenience.
Thanks for the help,

Dezso

from chembl_webresource_client.

mnowotka avatar mnowotka commented on August 11, 2024

@medozz - I gave you a piece of code with print statements and asked you to execute it and give me the output. Can you please do it for me? Otherwise I won't be able to help you.

from chembl_webresource_client.

medozz avatar medozz commented on August 11, 2024

The code does not run, because the import statement is before the print statements.
You sent:
from chembl_webresource_client.settings import Settings
url = Settings.Instance().UTILS_SPORE_URL
print url

import requests
r = requests.get(url)
print r.status_code
print r.ok
print r.json()

The first line does not run, and the code can not go further. That is the problem. :( It seems the ChEMBL library cannot imported.
Traceback (most recent call last):
File "C:/Working_projects/Cancer_related_fristeighbours/Experimental_validation/Python_project/Search_for_chemble_data_for_compounds.py", line 17, in <module> from chembl_webresource_client.settings import Settings
File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\chembl_webresource_client\__init__.py", line 23, in <module> from chembl_webresource_client.utils import utils
File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\gevent\builtins.py", line 93, in __import__result = _import(*args, **kwargs)
File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\chembl_webresource_client\utils.py", line 8, in <module> utils = client_from_url(Settings.Instance().utils_spore_url)
File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\chembl_webresource_client\spore_client.py", line 18, in client_from_url schema = session.get(url).json()
File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\requests\models.py", line 826, in json return complexjson.loads(self.text, **kwargs)
File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\simplejson\__init__.py", line 516, in loads return _default_decoder.decode(s)
File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\simplejson\decoder.py", line 370, in decode obj, end = self.raw_decode(s)
File "C:\Users\dm729\AppData\Local\Continuum\Anaconda2\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end())
simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Sorry for not inserting it again, but it has the same error.

from chembl_webresource_client.

mnowotka avatar mnowotka commented on August 11, 2024

OK, what if you try:

import requests
url = 'https://www.ebi.ac.uk/chembl/api/utils/spore'
r = requests.get(url)
print r.status_code
print r.ok
print r.json()

from chembl_webresource_client.

medozz avatar medozz commented on August 11, 2024

I found it myself as well, so:
https://wwwdev.ebi.ac.uk/chembl/api/utils/spore
500
False
Then error message.

from chembl_webresource_client.

mnowotka avatar mnowotka commented on August 11, 2024

If your UTILS_SPORE_URL points to https://wwwDEV.ebi.ac.uk/chembl/api/utils/spore instead of https://wwwdev.ebi.ac.uk/chembl/api/utils/spore this means you installed the unstable version of the client directly from this repo instead of using official stable version from PIP:

pip install -U chembl_webresource_client

from chembl_webresource_client.

medozz avatar medozz commented on August 11, 2024

THANK YOU VERY MUCH!

It works. Sorry for any inconvenience.

from chembl_webresource_client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.