Skip to content

AttributeError related to BeautifulSoup configuration #996

@aphearin

Description

@aphearin

I am using astroquery to interface with the CosmoSim database, where I have an active account. When I login using astroquery, I get an AttributeError that appears to be related to bs4, but I'm not sure how to fix it. Traceback below:

In [3]: from astroquery.cosmosim import CosmoSim

In [4]: CS = CosmoSim()

In [5]: CS.login(username="andrewhearin")
WARNING: Using the password found in the keychain for the provided username. [astroquery.cosmosim.core]
/Users/aphearin/anaconda/lib/python2.7/site-packages/astroquery/cosmosim/core.py:106: UserWarning: Authenticating andrewhearin on www.cosmosim.org...
  .format(self.username))
/Users/aphearin/anaconda/lib/python2.7/site-packages/astroquery/cosmosim/core.py:111: UserWarning: Authentication successful!
  warnings.warn("Authentication successful!")
/Users/aphearin/anaconda/lib/python2.7/site-packages/bs4/__init__.py:181: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 6 of the file /Users/aphearin/anaconda/bin/ipython. To get rid of this warning, change code that looks like this:

 BeautifulSoup(YOUR_MARKUP})

to this:

 BeautifulSoup(YOUR_MARKUP, "lxml")

  markup_type=markup_type))
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-4098c05c150f> in <module>()
----> 1 CS.login(username="andrewhearin")

/Users/aphearin/anaconda/lib/python2.7/site-packages/astroquery/query.pyc in login(self, *args, **kwargs)
    336     def login(self, *args, **kwargs):
    337         with suspend_cache(self):
--> 338             self._authenticated = self._login(*args, **kwargs)
    339         return self._authenticated
    340 

/Users/aphearin/anaconda/lib/python2.7/site-packages/astroquery/cosmosim/core.pyc in _login(self, username, password, store_password, reenter_password)
    127         if authenticated.status_code == 200:
    128             soup = BeautifulSoup(authenticated.content)
--> 129             self.delete_job(jobid=str(soup.find("uws:jobid").string),
    130                             squash=True)
    131 

AttributeError: 'NoneType' object has no attribute 'string'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions