Reputation: 11
I just tried mechanicalsoup in python through the command line and it worked. However, if I put it in a script I get the error that the module is not found. System: Linux/Openhabian. There is a python 2.7 and a python3 version as well installed. I tried it with the python3 version of course but I get this one:
File "script.py", line 1, in <module>
import mechanicalsoup
ModuleNotFoundError: No module named 'mechanicalsoup'
script (though it probably doesn´t help much)
import mechanicalsoup
from urllib.request import urlopen
login_page = browser.get("https://www.myurl.com")
browser = mechanicalsoup.Browser()
login_form = login_page.soup.find("form")
login_form.find ("input", {"name": "User"})["value"] = "mylogin"
login_form.find ("input", {"name": "Pass"})["value"] = "mypass"
login_response = browser.submit(login_form, login_page.url)
Some linux rights issue or what could cause that? Thanks.
Upvotes: 1
Views: 1537