Debug reg.cgi - how to know the exception detail in try..except

after digging more into the app i have found that when i run the http://192.168.0.110/cgi/reg.cgi?&username=shaun&identity=3
It returns false... which means that the reg.cgi could insert the username and identity inside sqlite db.. my problem is how will i know what error is coming as i dont have working knowledge of cgi script.. below is the code
How to print the type of error in except like in dotnet we have try...catch(Exception ex){ ex.messsage} where ex.message will tell me the error.. how to do this in cgi
print 'Content-type: text/plain\n\n<?xml version="1.0" encoding="utf-8"?>\n<result>'
if user:
    try:
        c = db.cursor()
        c.execute("insert or replace into registrations values (?, ?, datetime('now'))", (user, identity))
        print '\t<update>true</update>'
    except:
        print '\t<update>false</update>'
for f in friends:
    print "\t<friend>\n\t\t<user>%s</user>" % (xml.sax.saxutils.escape(f), )
    c = db.cursor()
    c.execute("select m_username, m_identity from registrations where m_username = ? and m_updatetime > datetime('now', '-1 hour')", (f, ))
    for result in c.fetchall():
        eachIdent = result[1]
        if not eachIdent:
            eachIdent = ""
        print "\t\t<identity>%s</identity>" % (xml.sax.saxutils.escape(eachIdent), )
        if f != result[0]:
            print "\t\t<registered>%s</registered>" % (xml.sax.saxutils.escape(result[0]), )
    print "\t</friend>"
db.commit()
print "</result>"

try:
  db_cursor.execute('some hopefully valid SQL;')
except sqlite3.Error, msg:
  print msg
After adding the above code i recieved an error : unable to open the database.. so after some googling
i found the below answer http://jaux.net/2008/12/18/sqlite3-unable-to-open-database-file/
Also Having being pissed for a while, I finally figured out what was wrong  here: The web server needs the write permission to not only the database  file, but also the containing directory of that file.

Similar Messages

  • How to know the update details in Solaris.

    Hi,
    We have server with solaris as version. We are able to find the version details like it is a solaris 10 but not able to find the update details. Could any body help me to find the same.
    REgards
    DBA.

    Hello.
    To see the original Solaris update used to install the system run "cat /etc/release":
    $ cat /etc/release
                       Oracle Solaris 10 9/10 s10s_u9wos_14a SPARC
         Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
                                Assembled 11 August 2010The above shows Solaris 10 Update 9
    The second part is to look at the Kernel Patch installed
    $ uname -a
    SunOS hostname 5.10 Generic_142909-17 sun4u sparc SUNW,SPARC-EnterpriseThe above shows this system has 142909-17. Use the matrix on this site to see what update it is: http://blogs.oracle.com/patch/entry/solaris_10_kernel_patchid_progression
    Hope it helps answer your question.
    Regards,
    Steve

  • How to write the exceptions in function module

    dear all,
         how to write the exceptions in function modules with example.
    thanq
    jyothi

    Hi,
    Raising Exceptions
    There are two ABAP statements for raising exceptions. They can only be used in function modules:
    RAISE except.
    und
    MESSAGE.....RAISING except.
    The effect of these statements depends on whether the calling program handles the exception or not. The calling program handles an exception If the name of the except exception or OTHERS is specified after the EXCEPTION option of the CALL FUNCTION statement.
    If the calling program does not handle the exception
    · The RAISEstatement terminates the program and switches to debugging mode.
    · The MESSAGE..... RAISING statement displays the specified message. Processing is continued in relation to the message type.
    If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE..... RAISING statement does not display a message. Instead, it fills the system fields sy-msgid, sy-msgty, sy-msgno , and SY-MSGV1 to SY-MSGV4.
    Source Code of READ_SPFLI_INTO_TABLE
    The entire source code of READ_SPFLI_INTO_TABLE looks like this:
    FUNCTION read_spfli_into_table.
    ""Local Interface:
    *" IMPORTING
    *" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
    *" EXPORTING
    *" VALUE(ITAB) TYPE SPFLI_TAB
    *" EXCEPTIONS
    *" NOT_FOUND
    SELECT * FROM spfli INTO TABLE itab WHERE carrid = id.
    IF sy-subrc NE 0.
    MESSAGE e007(at) RAISING not_found.
    ENDIF.
    ENDFUNCTION.
    The function module reads all of the data from the database table SPFLI where the key field CARRID is equal to the import parameter ID and places the entries that it finds into the internal table spfli_tab. If it cannot find any entries, the exception NOT_FOUND is triggered with MESSAGE ... RAISING. Otherwise, the table is passed to the caller as an exporting parameter.
    Calling READ_SPFLI_INTO_TABLE
    The following program calls the function module READ_SPFLI_INTO_TABLE:
    REPORT demo_mod_tech_fb_read_spfli.
    PARAMETERS carrier TYPE s_carr_id.
    DATA: jtab TYPE spfli_tab,
    wa LIKE LINE OF jtab.
    CALL FUNCTION 'READ_SPFLI_INTO_TABLE'
    EXPORTING
    id = carrier
    IMPORTING
    itab = jtab
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    CASE sy-subrc.
    WHEN 1.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
    WHEN 2.
    MESSAGE e702(at).
    ENDCASE.
    LOOP AT jtab INTO wa.
    WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
    ENDLOOP.
    The actual parameters carrier and jtab have the same data types as their corresponding interface parameters in the function module. The exception NOT_FOUND is handled in the program. It displays the same message that the function module would have displayed had it handled the error.
    Or
    just have to decide what exceptions u want and under what conditions.
    then declarethese exeptions under the exceptions tab.
    in the source code of ur function module.
    if
    like this u can code .
    now when u call the function module in tme mainprogram.
    if some error occurs and u have declared a exception for this then it will set sy-subrc = value u give inthe call of this fm.
    in the fm u can program these sy-subrc values and trigger the code for ur exception.
    Please reward if useful
    Regards,
    Ravi
    Edited by: Ravikanth Alapati on Mar 27, 2008 9:36 AM

  • How to know the type of a variable??

    how to know the type of a variable??
    For example, give you a variable s, how to determine if it is
    a primitive type, of an object?? If this is primitive type,
    any ways to determine if it is integer, boolean, double, ...??

    I am currently working on a project where this happens. I have a main type of object that all of my other types extend. While working on the objects in a method, any type of other object could be coming through. To test I try to cast the object and catch class cast exceptions. This only works because I know the different type that will be coming through....
    public void testObject(classX object){
      try{
        classY object = (classY)object;
      }catch(ClassCastException CC){
        try{
          classZ object = (classZ)object;
        }catch(ClassCastException CCC){
          /// the object fails to be cast as the types I tested for.
    }

  • How to know the length of a Byte array?

    how to know the length a byte array if it is an argument of the method, e.g.
    public byte[] hash(byte[] data) throws Exception
    I wanna store the length of data into a integer in the method of hash, but no idea how to get it
    THanks!

    to conclude:
    I am a newbie, I wanna know , those "System"
    methods as well.What exactly does that have to do with your original question?
    or instance:
    System.arrowcopy() , where can I find the
    definition also?You probably meant System.arraycopy. The documentation is called JavaDoc and for Java 1.5 (a.k.a. 5.0) it can be found here: http://java.sun.com/j2se/1.5.0/docs/api/index.html
    If you've not yet found the API documentation, then I'm pretty sure you should start with some tutorials, they probably point to all the interesting documentation as well.

  • How to know the technical name of psa

    hi BW gurus,
    I need to delete data from psa i need to increase the free space.  so how to know the technical name of psa.  and how to delete the data from psa.
    Thanks in advance

    Shahid,
    Agree with Tarun on this...
    Check the PSA technical name from the delete PSA option on the PSA screen of the AWB...the PSA name would be /bic/b000*...
    Shahid...also chek the table RSTSODS in SE11.
    U can find the PSA technical name in the field ODSNAME_TECH..
    Just enter the name of the PSA in the ODSNAME field..the PSA name would be
    your infosource followed by some extension.
    Deleting the data from the PSA:
    Shahid,
    this can be achieved via a program and also via the standard procedure of going to the PSA in the AWB and choosing the option delete the PSA data...
    Here select the requests which are older than any number of days or before any date..
    Hope this helps...
    Regs.
    Nick.
    Message was edited by:
            Nick

  • How to know the data transfer is complited? there is any message will get l

    how to know the data transfer is complited? there is any message will get like 'data uploaded is successfully complited' ?

    Hi,
    You can check SY-SUBRC = 0 or if there is an exception raised then an error occured.
    Regards,
    Ferry Lianto

  • How to log the exception using Log action in Oracle Service Bus

    Hi,
    Whenever an exception is raised how to log the exception using Log action in oracle service bus.After logging where I have to find the logged message.

    It would be in the log file for the managed server which ran the request. If you are logging the message at a lower level than your app server, however, you won't see it. You should be logging the exception at Error level.

  • How to know the dynamic values for this :AND category_id_query IN (1, :3, )

    Hi Team,
    R12 Instance :
    Oracle Installed Base Agent User Responsibility --> Item Instances -->
    Item Instance: Item Instances > View : Item Instance : xxxxx> Contracts : Item Instance : xxxxx> Service Contract: xxxxx>
    In the above page there are two table regions.
    Notes.
    -------------------------------------Table Region---------------------------
    Attachments
    -------------------------------------Table Region---------------------------
    --the attachments are shown using the query from the fnd_lobs and fnd_docs etc...
    I want to know what are the document types are displayed in this page ?
    --We developed a custom program to attach the attachments to the  services contracts and the above seeded OAF page displays those ..as needed.
    But after recent changes..the Attachments--> table region is not showing the attachments.
    I have verified the query..and could not find any clue in that..
    but i need some help if you guys can provide..
    SELECT *
    FROM
    *(SELECT d.DOCUMENT_ID,*
    d.DATATYPE_ID,
    d.DATATYPE_NAME,
    d.DESCRIPTION,
    DECODE(d.FILE_NAME, NULL,
    *(SELECT message_text*
    FROM fnd_new_messages
    WHERE message_name = 'FND_UNDEFINED'
    AND application_id = 0
    AND language_code  = userenv('LANG')
    *), d.FILE_NAME)FileName,*
    d.MEDIA_ID,
    d.CATEGORY_ID,
    d.DM_NODE,
    d.DM_FOLDER_PATH,
    d.DM_TYPE,
    d.DM_DOCUMENT_ID,
    d.DM_VERSION_NUMBER,
    ad.ATTACHED_DOCUMENT_ID,
    ad.ENTITY_NAME,
    ad.PK1_VALUE,
    ad.PK2_VALUE,
    ad.PK3_VALUE,
    ad.PK4_VALUE,
    ad.PK5_VALUE,
    d.usage_type,
    d.security_type,
    d.security_id,
    ad.category_id attachment_catgeory_id,
    ad.status,
    d.storage_type,
    d.image_type,
    d.START_DATE_ACTIVE,
    d.END_DATE_ACTIVE,
    d.REQUEST_ID,
    d.PROGRAM_APPLICATION_ID,
    d.PROGRAM_ID,
    d.category_description,
    d.publish_flag,
    DECODE(ad.category_id, NULL, d.category_id, ad.category_id) category_id_query,
    d.URL,
    d.TITLE
    FROM FND_DOCUMENTS_VL d,
    FND_ATTACHED_DOCUMENTS ad
    WHERE d.DOCUMENT_ID = ad.DOCUMENT_ID
    *) QRSLT*
    WHERE ((entity_name    ='OKC_K_HEADERS_V'-- :1
    AND pk1_value          IN ( 600144,599046) --:2
    AND category_id_query IN (1, :3, :4, :5, :6, :7) )
    AND datatype_id       IN (6,2,1,5)
    AND (SECURITY_TYPE     =4
    OR PUBLISH_FLAG        ='Y')))
    --='000180931' -- 'ADP118'
    The above seeded query is the one which is used for table region to retrieve the data..
    how to know the dynamic values for this : AND category_id_query IN (1, :3, :4, :5, :6, :7) )
    --Sridhar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi Patricia,
    is it working for restricted key figure and calculated key figure ??
    Note Number Fisc Period Opening Days
    1 1 2
    2 1 3
    3 1 0
    because I have other restriction, so I create two restricted key figure..
    RK1  with restriction :  Total Number of Note,
    RK2  with restriction :  Total Opening Days ,
    then I Created a calculated key figure, average opening days in a period
    CK1 = RK2 / RK1..
    in this case, I am not sure if it will work or not..
    for example, during RK2 calclation, it might be this   2+3 = 5, the line with 0 will be ignored..
    during RK1 calcualtion, it might be 1 + 1 + 1 = 3. ---> Not sure in this case, the line with opening days 0 will be calculated or not..
    could you please confirm..

  • With a contract number, how to know the total PO release value against it?

    Usually one contract corresponds to multiple PO records, now we know the contract number, then how to know the total PO release value against this contract.  In other word, we would like to know the total release value of all the POs with the same contract number.  To just input the contract number in EKPO table? but then look for which field in this table to add these PO release values up?
    We will give you reward points!
    Thanks!

    hi Mohammad,
    By following your instruction, input the contract number 4800000112 into Document number field, then hit Enter, get the following (only copy two records here for example), but kind of a mess.  Could you let us know which one is the PO release value for this contract?
    Contract   Type Vendor     Name                                 PGp Agmt. date
      Item  Material           Short text                               Mat. group
      D I A Plnt SLoc                 Targ.qty. Un       Net price  Curr.   per Un
    4800000112 WK   2000012012 GULF INTERSTATE FIELD SERVICES       QBH 06/20/2006
    Agreement start06/20/2006 Agreement end 12/31/2007
    Tgt. val.        1,000,000.00  USD   Open          1,000,000.00 USD   100.00 %
      00001                    Inspection Svcs, Construction            R3VNI
      L   U                                  0  UL            0.00  USD       1 EA
      00002                    Chief Inspector                          R3VNI
      L   U                                  0  DAY         390.00  USD       1 DAY

  • How to know the balance and validity of internet data in iPad

    How to know the balance and validity of internet data in iPad?

    Sir I m using internet in ipad4 with airtel network
    They provide me 2gb data with the amount of 255 rupees
    And now I inserted the sim in my ipad4
    And start the surfing on safari n all
    And now I wanted to know how much data is balance.

  • How to know the class method behind an enterprise service

    Hi,
    SAP has provided enterprise services for Room booking in Real Estate module. They are even shipping the complete application for a nominal price. But the standard version is not suitable for our client requirement so they want to develop this application inhouse.
    Now my question is:  I know the enterprise services used in this application. How to know the implementing methods behind these enterprise services ?
    If possible suggest which approach will be a better option for the inhouse development.
    1. Webdynpro ABAP and use directly methods behind the enterprise services.
    2. Webdynpro ABAP and create client proxy class for the enterprise services.
    3. Webdynpro JAVA and use the enterprise services.
    4. Using visual composer modelling the application.
    Please suggest the best alternative.
    Best Regards,
    Aleem Mohiuddin.

    Hi
    They are even shipping the complete application for a nominal price. But the standard version is not suitable for our client requirement so they want to develop this application inhouse.
    I assume you are talking about xApps.
    How to know the implementing methods behind these enterprise services ?
    In sproxy transaction you can search service and then you can see class and method implemented behind that particular service.
    1. Webdynpro ABAP and use directly methods behind the enterprise services.
    In my opinion not recommended to bypass ES and use method behind it.
    2. Webdynpro ABAP and create client proxy class for the enterprise services.
    Not sure why you want to create proxy of ES.
    3. Webdynpro JAVA and use the enterprise services.
    4. Using visual composer modelling the application.
    You can use either Webdynpro (ABAP or Java) or VC to model your application which consume ES in backend. Both options are good, you can chose Java or ABAP flavor of dynpro based on skill available in team. VC is very effective in rapid modelling and can be used in protyping or in development of complete application.
    Regards,
    Gourav

  • How to know the error in the goods movement

    Hai gurus,
    a) while doing goods issue and goods receipt , if there is any
        error  in the goods movement how to know the same and correct it.
    Regards,
    sekar chand

    Hi,
    If You are doing GR and GI during order confirmation then you will find a tab for Display Error(Bell Ikon).At the time of any error you will find this icon highlighted.press it you will find details error description and proposed solution.
    Regards,
    Dhaval

  • How to know the PO  Created with RFQ or Not..??

    Hi MM Gurus,
    How to know the purchase order created with one quotation or not. because when i am trying to create PO with /ME21N through DOcumen Overview on. there is list of Quotation. i created PO with XYZ quotation. and after creation of PO i am trying to create another PO with another quotation but in that list still XYZ quotation is Displying. so how to knows once PO cretd with Quotation or not. . and I dont wanted to disply quotation once created Po.
    Thanks in Advance.
    N.A.Reddy

    Hi Pradeep. Thanks for the mail.
    the problem is ....with *quotation...*
    How to know the purchase order created with one quotation or not.
    because when i am trying to create PO with /ME21N through DOcumen Overview on. there is list of Quotation.
    I created PO with XYZ quotation. and after creation of PO i am trying to create another PO with another quotation but in that list still XYZ quotation is Displying.
    so how to knows once PO cretd with Quotation or not. .
    and I dont wanted to disply quotation once created Po.
    Thanks in Advance.
    N.A.Reddy

  • How to know the count of record in CR XI?

    Post Author: Liu ming
    CA Forum: Deployment
    Hi All,
    I create a report by CR XI release 2. The report is viewed in ASP.Net. So, I would like show a message when the report have no record. My question is how to know the count of record?
    Thanks.

    I was able to do this by using
    ora:countNodes('Receive_1_Read_InputVariable','BILL','/ns2:BILL/ns2:CMS1500')

Maybe you are looking for