473,320 Members | 2,122 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,320 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 2695
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.