Forums

After install 'dryscrape' the module it doesn't work!

Hi, i've done everything all right to install dryscrape. Yet, now seems when i import it in my code the app gives 500 error. i'm concerned about when i've run in bash console the code provided in the answer

virtualenv env

i seems created virtualenv variable called env which is not in the .virtualenv/ folder (http://joxi.ru/DmB7jgNi5XMw2P). files

In that folder .virtualenv/ there is before created virtualenv variable mytest_virtenv along with some other files (http://joxi.ru/1A5RkLzhvoe0rE). files

But when i add import dryscrape app doesn't work. Help please! Example code:


@app.route('/dryscrape_off')
def dryscrape_off():
    import dryscrape
    my_url='http://tarex.ru/testdir/test1.html'
    my_url='https://docs.python.org/2/'
    from bs4 import BeautifulSoup
    response = requests.get(my_url)
    soup = BeautifulSoup(response.text)

    return '<h3>dryscrape off</h3> <p> result: '

If you want to use a virtualenv in your web app, you need to enter the path to it into the "Virtualenv" field on the "Web" tab. It's the third section down, after "Actions" and "Code".

ok, i've added the line where you've pointed to. But now i get problem with flask (my app is a flask app): ImportError: No module named flask,

error log:

    13:45:29,904 :ImportError: No module named flask
13:45:31,664 :Traceback (most recent call last):
13:45:31,664 :  File "/bin/user_wsgi_wrapper.py", line 130, in __call__
13:45:31,664 :    self.error_log_file.logger.exception("Error running WSGI application")
13:45:31,664 :  File "/usr/lib/python2.7/logging/__init__.py", line 1185, in exception
13:45:31,665 :    self.error(msg, *args, **kwargs)
13:45:31,665 :  File "/usr/lib/python2.7/logging/__init__.py", line 1178, in error
13:45:31,665 :    self._log(ERROR, msg, args, **kwargs)
13:45:31,665 :  File "/usr/lib/python2.7/logging/__init__.py", line 1270, in _log
13:45:31,666 :    record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
13:45:31,666 :  File "/usr/lib/python2.7/logging/__init__.py", line 1244, in makeRecord
13:45:31,666 :    rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
13:45:31,666 :  File "/usr/lib/python2.7/logging/__init__.py", line 284, in __init__
13:45:31,666 :    self.threadName = threading.current_thread().name
13:45:31,667 :  File "/usr/lib/python2.7/threading.py", line 1160, in currentThread
13:45:31,667 :    return _active[_get_ident()]
13:45:31,667 :  File "/bin/user_wsgi_wrapper.py", line 122, in __call__
13:45:31,667 :    app_iterator = self.app(environ, start_response)
13:45:31,667 :  File "/bin/user_wsgi_wrapper.py", line 136, in import_error_application
13:45:31,667 :    raise e

You haven't installed Flask into your virtualenv. A virtualenv does not have any of the pre-installed packages that PythonAnywhere so you have to install the packages you need.

ok, is there a tutorial of how to install in virtualenv other help?

Yes It's aimed at Django, but the principles are the same.