473,385 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Error with form

7
Hello

I'm new here, but I need some help. I'm trying to do a login into the safilo website (http://www.safilonet.safilo.com/) running python code.
There is an error that I'm not capable to find where it is:

---------- run.py
Expand|Select|Wrap|Line Numbers
  1. """UPDATE SAFILO"""
  2.  
  3.         ss = SafiloSupplier(updateBrands=True)
  4.  
  5.         #ss.resetLog()
  6.         #ss.printBrands()
  7.  
  8.         brds = ss._brands
  9.  
  10.         start_at_brand = ''
  11.         print 'Brands before filtering:', len(brds)
  12.         if len(start_at_brand) > 0:
  13.             while len(brds) > 0 and brds[0]._ref != start_at_brand:
  14.                 brds.pop(0)
  15.         print 'Brands after filtering:', len(brds)
  16.         #sys.exit(0)
  17.  
  18.         #ss.clearAllModelFromSql()
  19.  
  20.         for b in brds:
  21.             ss.addToLog('** BRAND %s... **' % b._ref, True)
  22.  
  23.             print '*** Updating catalog... ***'
  24.             ss.updateCatalog(b._ref)
  25.  
  26.             print '*** Expanding models... ***'
  27.             ss.expandModels(b._ref)
  28.  
  29. ----------- Supplier.py
  30.  
  31. class SafiloSupplier(Supplier):
  32.     '''
  33.     100% faulty HTML webscrapping client for Safilo supplier.
  34.     Uses hand-made MiniTidy class for converting HTML to valid XML for further parsing.
  35.     '''
  36.  
  37.     def __init__(self, updateBrands=False, login=True):
  38.         Supplier.__init__(self)
  39.  
  40.         self._name = 'Safilo'
  41.         self._username = '******' 
  42.         self._password = '******' 
  43.         self._baseUrl = 'http://www.safilonet.safilo.com'
  44.         self._ignoreBrandsWithRef = ['BLU', 'SAF']
  45.         self._root += 'safilo\\'
  46.         self._brandsPC = PersistLite(instance=Brand(), path=self._root + 'brands\\brands.sqlite')
  47.         self.last_logged_in = None
  48.  
  49.         if login: self.login()
  50.  
  51.         if updateBrands:
  52.             self.updateBrands()    # also saves
  53.         else:
  54.             self.loadBrands()
  55.  
  56.         self.filterBrands()
  57.  
  58.  
  59.     def check_login(self):
  60.         n = datetime.datetime.now()
  61.         dt = n - self.last_logged_in
  62.         if dt.seconds > 120:
  63.             print 'Logged in for %d seconds. Logging in again...' % dt.seconds
  64.             self.login()
  65.  
  66.     ##webapp/commerce/safilo/jsp/logon.jsp
  67.  
  68.     def login(self):
  69.         url = self._baseUrl + '/webapp/commerce/logon'
  70.         self._br.open(url, timeout=30.0)
  71.         self._br.select_form('logon')
  72.         self._br.form['login'] = self._username
  73.         self._br.form['password'] = self._password
  74.         self._br.submit()
  75.  
  76.         if self._verbose: print 'Login successful.\n'
  77.  
  78.         self.last_logged_in = datetime.datetime.now()
  79.  
  80. There is more code in both files, but i think the error is somewhere on this peace of code.
  81.  
  82. The error presented is:
  83.  
  84. Traceback (most recent call last):
  85.   File "E:\billy\Projects\GlassInteg\trunk\src\run.py", line 89, in <module>
  86.     go()
  87.   File "E:\billy\Projects\GlassInteg\trunk\src\run.py", line 39, in go
  88.     ss = SafiloSupplier(updateBrands=True)
  89.   File "E:\billy\Projects\GlassInteg\trunk\src\GlassInteg\Supplier.py", line 280, in __init__
  90.     if login: self.login()
  91.   File "E:\billy\Projects\GlassInteg\trunk\src\GlassInteg\Supplier.py", line 302, in login
  92.     self._br.select_form('logon')
  93.   File "build\bdist.win32\egg\mechanize\_mechanize.py", line 524, in select_form
  94. mechanize._mechanize.FormNotFoundError: no form matching name 'logon'
Can you please help me?
Sep 19 '12 #1

✓ answered by Rabbit

Which page are you getting that from? Because that form may exist on http://www.safilonet.safilo.com but that's not where you're trying to login from. In your code, you're trying to login from http://www.safilonet.safilo.com/webapp/commerce/logon and that page has no such form.

5 2697
Rabbit
12,516 Expert Mod 8TB
It would help to know what that error message is.
Oct 9 '12 #2
ATNC33
7
@Rabbit The error message is on the line 82. I haven't still solved this problem! I can't understand what's going on...
Oct 9 '12 #3
Rabbit
12,516 Expert Mod 8TB
It sounds like a pretty clear error message. There's no form on that page named logon.
Oct 9 '12 #4
ATNC33
7
There is a form named logon,

Take a look at this source code:

Expand|Select|Wrap|Line Numbers
  1. <form action="https://www.safilonet.safilo.com/webapp/commerce/logon" method="post" target="_top" name="logon" onsubmit="return checkFields();" enctype="application/x-www-form-urlencoded">
Oct 9 '12 #5
Rabbit
12,516 Expert Mod 8TB
Which page are you getting that from? Because that form may exist on http://www.safilonet.safilo.com but that's not where you're trying to login from. In your code, you're trying to login from http://www.safilonet.safilo.com/webapp/commerce/logon and that page has no such form.
Oct 9 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Bill Clark | last post by:
I just had MS Access 97 loaded on my machine. When I try to use the Chart Wizard, I get an error stating: Method 'Form' of object '_Subform' failed Any thoughts? Is there something that...
2
by: Scott Collens | last post by:
Hi all, My page is causing a javascript error. The page is test.aspx and contains a form tag: <form id="theform" runat="server"> Because I have several user controls on the page each of...
2
by: Larry | last post by:
Is it possible to show the text that would appear in the default IIS error page, but have that text appear on the custom form when using the <customErrors mode="RemoteOnly"...
3
by: Eagle | last post by:
First I tried using the try, catch, throw, but it errored on the throw and I don't want it to stop there, I want it to stop in the frm, not the class. Next I set a Session to catch the error, and...
2
by: Tom Clavel | last post by:
Scratching my head. I am using the filter property on a combo box .AfterUpdate event to get to a single client record. This is causing a some strange behavior: As I enter a subform, I get a no...
5
by: Blasting Cap | last post by:
I would like for a page in my app (asp.net framework 2.0, VS 2005) to both display a message to the user, as well as sending an email when an error occurs. I have code in the global.asax.vb...
1
by: ge0193387 | last post by:
I have an object on my form the does reading from a file and another that writes to a file. Simple operation just Readline()/Writeline(). I had a problem previously where my form would throw up an...
2
by: mars123 | last post by:
hi, I am facing a js error in my code, below is the prob. statement I have a radio2 javascript function as below, it works like this.. When a parent radio button is selected only one of its...
2
by: munkee | last post by:
Hi all, Basically I have been using form validation incorrectly. Partly because of laziness which I now feel is going to really bite me back if I dont get it sorted. On all of my forms I have a...
11
by: munkee | last post by:
Hi all, I have a weird problem and likely just something in my code I am missing completely. Basically I use similar code on sub form within a form and the after update event runs correctly. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.