0

I've got both python 2.7 and 3.5 installed on my Mac OSX 10.7.4. My python script written in 3.5 works fine using the command:

python3 <file.py>

However, running another script compatible with python 2.7 gives me this error:

python testfile.py
Traceback (most recent call last):
  File "testfile.py", line 29, in <module>
    br.select_form(name="signinWidget")
  File "build/bdist.macosx-10.7-intel/egg/mechanize/_mechanize.py", line 524, in select_form
mechanize._mechanize.FormNotFoundError: no form matching name 'signinWidget'

The script uses mechanize and BeautifulSoup packages.

>which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python

I tried:

python -m pip install BeautifulSoup,mechanize

but it does not resolve this.

How do I ensure that the script is pointing to the correct packages which are installed on my mac already?

Prad
  • 1
  • 2

1 Answers1

0

you should try pip3 to install python3's module

pip3 install BeautifulSop4 
Jason
  • 11
  • 3
  • My problem is with running python 2.7 where the packages are not being recognized. >python -m pip install BeautifulSoup,mechanize Requirement already satisfied (use --upgrade to upgrade): BeautifulSoup in /Library/Python/2.7/site-packages/BeautifulSoup-3.2.1-py2.7.egg You are using pip version 8.0.2, however version 8.1.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. Pip upgrade also did not cut it. – Prad Oct 31 '16 at 05:01
  • File "build/bdist.macosx-10.7-intel/egg/mechanize/_mechanize.py", line 524, in select_form mechanize._mechanize.FormNotFoundError: no form matching name 'signinWidget' – Jason Oct 31 '16 at 05:25
  • no form matching name 'signinWidget' , is No name is found in the form of the table , Is not the problem that the packages are not being recognized – Jason Oct 31 '16 at 05:29
  • You should confirm the name of form. This has a similar problem,[link](http://stackoverflow.com/questions/16020117/mechanize-mechanize-formnotfounderror-no-form-matching-name-q/16020863) – Jason Oct 31 '16 at 05:33
  • I really appreciate you pointing me in the right direction. The script is trying to access login on 'seller central.amazon.in'. I verified the widget using 'inspect element' and the form name is 'signinWidget'. This used to work before but stopped after few months. Once again, my apologies, if I am missing anything obvious. – Prad Nov 01 '16 at 04:50
  • I try to find the form name is 'signinWidget' on 'seller central.amazon.in', but there no form name is 'signinWidget' , you can try ' $("form[name='signinWidget']") ' command in console , there has a form name is 'signIn' , you can use $("form") or $('form[name="signIn"]') command to find it in console – Jason Nov 01 '16 at 05:40