1

I'm trying to make a program which reissues the books i have taken from my college library, for that i'm supposed to put my USER-ID in the form and submit it, and do the the rest of the code. but i'm not even able to fetch the page where all my books are listed , i'm getting TypeError when i'm trying to print the contents of the page where my books are listed.

here is the whole traceback.

Traceback (most recent call last):
  File "C:/Users/User/PycharmProjects/dictionary/reissue.py", line 43, in 
<module>
    sign_up['txtmemberid'].value = 'user-id'
TypeError: 'NoneType' object is not subscriptable

Process finished with exit code 1

and here is my code.

url = 'http://xx.yy.zz.abc:defg/opac/html/checkouts'  
browser = RoboBrowser(history=False ,parser='lxml')  
browser.open(url=url)  

sign_up = browser.get_form(action='./memberlogin')
sign_up['txtmemberid'].value = 'user-id'
opens = browser.submit_form(sign_up)
print(opens.parsed)

and the form source-code.

<form name="form" method="POST" action="./memberlogin" 
onsubmit="this.onsubmit= function(){return false;}">


<table class="loginTbl" border="1" align="center" cellspacing="3" 
cellpadding="3" width="60%">
   <input type="hidden" name="hdnrequesttype" value="1">
   <thead>
   <tr>
    <td colspan="3" align="middle" class="loginHead">Login</td>
   </tr>
   </thead>

   <tbody class="loginBody">
   <tr>
    <td class="loginBodyTd1" nowrap="nowrap">Employee ID</td>
    <td class="loginBodyTd2"><input type="text" name="txtmemberid" 
id="txtmemberid" value="" class="loginTextBox" size="30" tabindex="1" 
maxlength="8"></td>
    <td class="loginBodyTd3" rowspan="2"><input type="submit" 
class="goclearbutton" value="  Go  " tabindex="3" 
onblur="javascript:setFocus()"></td>

any help?

P.hunter
  • 1,345
  • 2
  • 21
  • 45
  • The error means your variable `sign_up` is `None`. Likely because you reference it by the `id="txtmemberid"` but the `form` tag doesn't contain that ID. I don't know much about RoboBrowser but perhaps you can reference it by the class name only. Or possibly by `name="form"` – Cfreak Mar 21 '17 at 14:49
  • the error persists. – P.hunter Mar 21 '17 at 15:02
  • @jm.carp i'm sorry to disturb you, but can you please help me with this problem, i saw other stackoverflow qyestions on thsi topic and your answers as well and read the documentation but it isn't help And no one is able to answser this and my previous `robobrowser` questions either ,i'm new to [`robobrowser`](http://stackoverflow.com/users/1222326/jm-carp) please – P.hunter Mar 22 '17 at 13:09

0 Answers0