File seek in wlst fails for lines longer than 8091 characters

For a CSV file generated in WLST i want to update the header, the first line of the output file, when new metrics have been detected. This works fine by using seek to go to the first line and overwriting the line. But it fails when the number of characters of the first line exceeds 8091 characters.
I made simplified script which does reproduce the issue i am facing here.
    #!/usr/bin/python
    import sys
    global maxheaderlength
    global initheader
    maxheaderlength=8092
    logFilename = "test.csv"
    # Create (overwrite existing) file
    logfileAppender = open(logFilename,"w",0)
    logfileAppender.write("." * maxheaderlength)
    logfileAppender.write("\n")
    logfileAppender.close()
    # Append some lines
    logfileAppender = open(logFilename,"a",0)
    logfileAppender.write("2nd line\n")
    logfileAppender.write("3rd line\n")
    logfileAppender.write("4th line\n")
    logfileAppender.write("5th line\n")
    logfileAppender.close()
    # Seek back to beginning of file and add data
    logfileAppender = open(logFilename,"r+",0)
    logfileAppender.seek(0) ;
    header = "New Header Line" + "." * maxheaderlength
    header = header[:maxheaderlength]
    logfileAppender.write(header)
    logfileAppender.close()
When maxheaderlength is 8091 or lower i do get the results as expected. The file test.csv starts with “New Header Line" followed by 8076 dots and followed by the lines 2nd line 3rd line 4th line 5th line
When maxheaderlength is 8092> the test.csv results as a file starting with 8092 dots followed by "New Header Line" and then followed by 8077 dots. The 2nd ... 5th line are now show, probably overwritten by the dots.
Any idea how to work around or fix this ?

For the benefit of others, i got a workaround from Jeremy Gosling on a crosspost on stackoverflow.
I too was able to reproduce this extremely odd behaviour and indeed it works correctly in Jython 2.5.3 so I think we can safely say this is a bug in 2.2.1 (which unfortunately you're stuck with for WLST).
My usual recourse in these circumstances is to fall back to using native Java methods. Changing the last block of code as follows seems to work as expected :-
# Seek back to beginning of file and add data
from java.io import RandomAccessFile
logfileAppender = RandomAccessFile(logFilename, "rw")
logfileAppender.seek(0) ;
header = "New Header Line" + "." * maxheaderlength
header = header[:maxheaderlength]
logfileAppender.writeBytes(header)
logfileAppender.close()

Similar Messages

  • ORA-01460 at REPLACE for strings longer than 4000 characters

    the following code works fine for vVar_Value less than 4001 characters but raises an ORA-01460 for strings equal to or larger than 4001 characters in my environments.
    declare
    vVar_Value VARCHAR2(32000) := '';
    begin
    for i in 1..4000 loop
    vVar_Value := vVar_Value||'X';
    end loop;
    dbms_output.Put_Line('length(vVar_Value): '||length(vVar_Value));
    SELECT REPLACE( vVar_Value, 'NO_MIDDLE_NAME', '') INTO vVar_Value FROM DUAL;
    exception
    when others then
    raise;
    end;
    any advice would be most apprectiated.
    thanks in advance.

    Why the heck are you using select from dual?
    Just use vVar_Value := REPLACE( vVar_Value, 'NO_MIDDLE_NAME', ''); and everything will be OK
    in SQL limit for varchar2 is 4K, only in PL/SQL you can use 32K
    Gints Plivna
    http://www.gplivna.eu

  • How to find the urls that are longer than 260 characters

    Hi
    I'm getting an error using Restore-SPSite thats most likely caused by URL's longer than 260 characters. How can I find out which URL's are too long? It's a huge site collection so it's not an option to search manually.
    Regards
    Jakob

    check this blog, allows you to take an inventory of all files in your web application and flag those files where the path (or URL) is longer than 260 characters.
    Locating files and pages with URLs that are too long for SharePoint
    Also check this: http://social.technet.microsoft.com/Forums/en-US/881d62e6-08c3-43b6-a9f1-96161ffa0201/how-to-write-a-powershell-script-to-find-the-url-path-length-of-all-the-files-and-folders-in?forum=sharepointdevelopmentprevious
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • YOUTUBE says my account IS ABSOLUTELY eligible for uploads longer than 15 minutes but FCPX says i am NOT eligible...

    HELP! YOUTUBE says my account  is eligible for uploads longer than 15 minutes, however, I am trying to upload a file from Final Cut Pro X using the SHARE BUTTON and FCPX says my account is NOT ELIGIBLE for vides over 15 minutes. How can I make sure that Final Cut is updated with this proper info from youtube? PLEASE HELP!!! I HAVE TO GET A VIDEO UP ASAP!

    David and Keith have got this right. Don't depend on FCP to do the account verification and upload. Export your movie and use Compressor, or MPEG STreamclip, or QT Pro to spit out an h.264. Manually upload. Be generous in setting video quality. YT, Vimeo  et al will recompress and the more information your file contains (within reason) the better. Just make sure any interlaced material is de-interlaced (a vote for Compressor) and the process will be smoother if you give them 29.97 frame rates,
    Russ

  • How can I to send an email with a longer than 50 characters subject?

    I'm trying to send an email through an abap program ( report ), but when the email arrives to the SOST transaction the subject is cut to 50 characters. How can I send an email with a longer than 50 characters subject?

    check this below code and do changes in ur report
    FORM SEND_MAIL_SUPPORT  TABLES   P_EM_BODY
                            USING    P_TITLE.
    *_ Start of the code to send an email notification
      DATA : ATTACH_REC TYPE I.
      DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE,
            OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE,
            OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE,
            OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE,
            DOC_CHNG LIKE SODOCCHGI1,
            TAB_LINES LIKE SY-TABIX.
    Creation of the document to be sent
      DOC_CHNG-OBJ_NAME = 'Mat Attach'(010).
      DOC_CHNG-OBJ_DESCR = P_TITLE.
      APPEND LINES OF P_EM_BODY TO OBJTXT.
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    *Creation of the entry for the compressed document
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'.
      APPEND OBJPACK.
      DESCRIBE TABLE IT_ERROR LINES ATTACH_REC.
      IF ATTACH_REC GE '1'.
    *Start of email attachement of internal table conversition
       APPEND LINES OF IT_ERROR TO OBJBIN.
    WRITE: '----
    ' TO OBJBIN.
    APPEND OBJBIN.
    CLEAR OBJBIN.
    CONCATENATE 'CCode.' 'A/CDocNum.' '  FYear.' 'DType.' 'PDate.' '  RefField.' INTO
                 V_TEXT SEPARATED BY ' '.
    APPEND V_TEXT TO OBJBIN.
    CLEAR V_TEXT.
    WRITE: '----
    ' TO OBJBIN.
    APPEND OBJBIN.
    CLEAR OBJBIN.
    LOOP AT IT_ERROR.
    CONCATENATE IT_ERROR-BUKRS IT_ERROR-BELNR IT_ERROR-GJAHR IT_ERROR-BLART
                 IT_ERROR-BUDAT IT_ERROR-STATUS INTO V_TEXT SEPARATED BY '   '.
    APPEND V_TEXT TO OBJBIN.
    CLEAR V_TEXT.
    ENDLOOP.
    WRITE: '----
    ' TO OBJBIN.
    APPEND OBJBIN.
    CLEAR OBJBIN.
        DESCRIBE TABLE OBJBIN LINES OBJPACK-BODY_NUM.
        OBJPACK-TRANSF_BIN = 'X'.
        OBJPACK-HEAD_START = 1.
        OBJPACK-HEAD_NUM = 1.
        OBJPACK-BODY_START = 1.
        OBJPACK-DOC_SIZE = OBJPACK-BODY_NUM * 255.
        OBJPACK-DOC_TYPE = 'RAW'.
        OBJPACK-OBJ_DESCR = 'List of Error Documents'(012).  " Description
        APPEND OBJPACK. CLEAR OBJPACK.
      ENDIF.
      RECLIST-RECEIVER = S_EMAIL-LOW.
      RECLIST-REC_TYPE = 'U'.
      RECLIST-COPY = 'X'.
      APPEND RECLIST.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = DOC_CHNG
          PUT_IN_OUTBOX              = 'X'
          COMMIT_WORK                = 'X'
        TABLES
          PACKING_LIST               = OBJPACK
          OBJECT_HEADER              = OBJHEAD
          CONTENTS_BIN               = OBJBIN
          CONTENTS_TXT               = OBJTXT
          RECEIVERS                  = RECLIST
        EXCEPTIONS
          TOO_MANY_RECEIVERS         = 1
          DOCUMENT_NOT_SENT          = 2
          OPERATION_NO_AUTHORIZATION = 4
          OTHERS                     = 99.
    *CHECK SY-SUBRC = 0.
    ENDFORM.                    " SEND_MAIL_SUPPORT

  • Getting this error when saving: Names longer than 31 characters are not supported on the destination volume

    I've just tried to save a document in Pages and got this error
    Names longer than 31 characters are not supported on the destination volume
    Never had a problem like this before. I haven't changed disks or formatted disks. Running latest Yosemite 10.10
    The only reference I can find to this error on the internet says that it's for applications prior to OS X which I think we can discount.
    The only other reference I can find in the support community relates to one person with problems saving attachments in Mail and dates from early 2014.
    Can anybody give me a suggestion on what I might need to do?
    Thanks

    What format are you saving to?
    Where are you saving the files to and what is that volume formatted as?
    Have you tested with files from other applications, such as TextEdit?
    Peter

  • "entry in field bank account number is longer than 10 characters"

    Hello Sap Experts,
    The user is getting an error on saving the bank infotype. (0009). The user is trying to create a IT0009 for an international assignee.The error is "entry in field bank account number is longer than 10 characters.
    The default characters allowed maximum specified in the technical field is 18 characters. The abaper also checked and confirmed that it is specified as 18 characters.
    This is only for a single employee.
    Please provide your suggestions.
    Thanks
    Jyothsna

    Jyothsna,
    You need to extend Bank Account number length....even though 18 will be the max length..by default assignment of length will be different from country to country. So you need to extend the length of Bank a/c number in trasaction OY17.....select the country and change the bank a/c number length to 18 and Checking rule to 5 max value length.
    Mohan

  • Tag attributes can't be longer than 8 characters?

              Hi,
              I am in the process of migrating a web application from another server to Weblogic
              7.0 and have run into the problem that none of my tags with attributes longer
              than 8 characters seems to work. The error message I get is :
              /Login.jsp(8): Error in using tag library uri='webtool.tld' prefix='tool': The
              Tag class '<classname>' has no setter method corresponding to TLD declared attribute
              '<attribute name>', (JSP 1.1 spec, 5.4.1)
              probably occurred due to an error in /Login.jsp line 8:
              <%@ taglib uri="webtool.tld" prefix="tool" %>
              I can make this go away by shortening the attribute name, but I have a lot of
              attributes with long names...is the limit configurable somwhere?
              Thanks in advance,
              Karen
              

    Are you trying to use a distribution list?
    If so, what if you get the actual email SMTP address (in outlook, look in the "E-mail Addresses" tab) and try that instead?
    Sincerely,
    Ted Ueda

  • LSK longer than 30 characters ?

    Hi !
    Is it possible to set the length of Legacy System Key to be longer than 30 characters ?
    Thank you for your help!
    Best regards,
    Peter

    Hi,
    if you speak about legacy keys for Contract account or Contract then you can create customer includes CI_EVER(tbl EVER )
    and CI_FKKVK (tbl FKKVK).
    For Contract exist enhancement "SMOD_EMDK0001 - IS-U: Contract - Subscreen Integration and Field Check".
    For Contract account exist user-exit PBO EXIT_SAPLES37_030 and PAI EXIT_SAPLES37_031.
    For customer screen you define PBO, PAI method and via spro hide standard field.
    May be exist customizing possibility to change length LSK, but i not found and always using abap-code((
    Igor

  • The text literal '''. is longer than 255 characters...

    friends,
        am getting an error "The text literal ''.    ' is longer than 255 characters. check whether it ends correctly in the very first line of the Report statement. what could be the problem? thanks all.

    Hi sathish,
    Please check whehter you have done like this
    A = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxx'
    in the same line, if you have done as above please
    do like this
    A =
    'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'.
    Thanks,
    Krishnakumar
    Message was edited by: Krishnakumar

  • OSX Server webdav bug? - files and folders disappears when filenames are fewer than 7 characters

    OSX Server webdav bug? - files and folders disappears when filenames are fewer than 7 characters
    Dear Community,
    i have a BIG problem with Apple webdav.
    All files or folders with fewer than 7 characters in filename disappear.
    The problems is only between Mac Server and Mac Clients
    and exists since OSX Server 1 (Server 10.7, 10.8, 10.9) on ALL Macs i know.
    The problem persist ever and occurs in the following settings:
    Mac Server (1.x, 2.x, 3.x) <> Mac Clients (10.7.x, 10.8.x, 10.9.x, 10.6 not tested)
    The problem does NOT occur in the following settings:
    Mac Server <> Windows Clients
    Mac Server <> Linux Clients
    Linux Server (my Webhoster) <> Mac Clients
    Windows Server (my Webhoster) <> Mac Clients
    So i think it is not a problem with server itselv or a single client only,
    it is probaly a problem with the combination betwen mac servers and mac clients.
    This is NOT a problem with MY MacServers/Clients only and not with only one Server.
    It occurs in many different Places and many different Machines.
    I have contact Apple Support more then tree times (always when i setup a new machine with server.app)
    but she said they heard first time about that and she cannot reproduce that problem.
    please, can somebody try it out?
    sorry for my bad englisch.
    best regards
    rené

    Supplement note:
    The Problem occurs also between OSX Server <> OpenWRT (Linux)
    best regards
    rené

  • Reading Text longer than 132 Characters including Special characters

    Hello Seniors,
    Could you please give me some information about the following Function Modules also?
    'SOTR_STRING_CREATE_CONCEPT'
    'LXE_OBJ_TEXT_PAIR_READ_SOTR'
    'SOTR_STRING_READ_TEXT_WITH_KEY'
    I was able to create a concept by using the Function module 'SOTR_STRING_CREATE_CONCEPT'. Now, I need to create a text and then read the text where ever I want (the text can be longer than 132 characters and also may contain special characters) from abap functions as per my requirement.
    my requirement is not based only on SAP Scripts.
    Thank you,
    cnc.

    check in  url    www.SE37.com
    regards,
    Prabhu

  • Intermittent error saving attachments from mail: "Names longer than 31 characters are not supported on the destination volume."

    I am reciving intermittent errors saving attachments from mail: "Names longer than 31 characters are not supported on the destination volume."

    I am seeing this too.
    I Posted in similar thread 6704033
    Error when saving calendar exports-names longer than 31 characters not supported on the destination volume.
    Very spooky. Not always reproducible, but it happened to me while using Office365-Outlook web-based email (saving a PDF).
    RE: the suggestion, checking security box "allow apps downloaded from all sites" I would really rather not do that.
    On my system it is set to allow "Mac App store and identified developers."
    Oh sorry, I'm on Yosemite, I see this is Mav forum...

  • Maintenace view for fld more than 500 characters

    Ho do i create a maintenance view for fld more than 500 characters? i  need a maintenance view to maintain URL which is sometimes more than 500 chars.

    The way SAP solves this for webservices is via a hash.
    Once you have executed the service, the URL populates a mapping table and generates a unique hash value for it.
    Via this hash, you can assign it to authorization fields and use it in your coding where the fields have limitations.
    As a consequence this causes some confusion if you dont use F4, but it does work.
    Cheers,
    Julius

  • Strings longer than 127 characters

    Hello,
    is it now possible to add a String from a POJO with more than 127 characters?
    Thanks
    Christian

    When you design a Crystal Reports report in Crystal Reports for Eclipse, where you drop in a POJO class for a datasource, you'll see that all String columns are given the default length of 127.
    When you inject a Collection of POJO class instances into the report using the setDataSource(java.util.Collection, ...), you'll see that any String with length greater than 127 is truncated. 
    How do you avoid this?
    In the JRC for XI R2 - you could re-compile the pojoSample.jar file after modifying the default value, or you could specify a longer length using the POJOResultSetFactory.setMemberColumnDisplaySize(...) method.
    The POJOResultSetFactory method for Crystal Report for Eclipse has been renamed and incorporated into rasapp.jar.  The source code for the POJO factory classes are no longer provided - thus, the XI Release 2 solutions do not work.
    So what you will need to do for CR for Eclipse, is you must manually create the ResultSet by invoking the com.crystaldecisions.sdk.occa.report.application.internal.POJOResultSetHelper class directly - POJOResultSetHelper is for CR4E what POJOResultSetFactory was for XI Release 2.
    Here's a code snippet:
        // SimplePojo.class is my POJO class, getName is a String property for the class,
        // and arrayList is the Collection of POJO class instances.
        POJOResultSetHelper pojoHelper = new POJOResultSetHelper(SimplePojo.class);
        pojoHelper.setMemberColumnDisplaySize("getName", 256);
        java.sql.ResultSet rs = pojoHelper.createResultSet(arrayList);
        reportClientDocument.getDatabaseController().setDataSource(rs, "SimplePojo", "SimplePojo");
    a programmer learning programming from perl is like a chemisty student learning the definition of "exothermic" with dynamite

Maybe you are looking for

  • Opening cs4 docs in indesign 2.0

    Hi, at work i am using indesign 2.0 but at home i use cs4. is there anyway to save cs4 docs so they can be viewed using 2.0?

  • Looking for simple instructions on how ARD works between two wireless units

    My Admin computer for ARD is on a wireless network at home. I need to control another computer of mine at the office which is also on a separate and wireless network. Two computers, both connecting to the Internet from behind wireless routers feeding

  • How do I add fold marks in inDesign?

    I have created a tri-fold brochure and am now stuck as I can't remember how to add fold lines which will be outside of the print area but that the printer will see (when the document is exported as a PDF)? I am using CS4 - if that makes any differenc

  • Enterprise subordinate CA does not show up in certificate authorities list

    After much discussion I decided the best approach was to clean eveything up and start over. I went through the KB on decommissioning an enterprise CA and Subordinate CA, install a new standalone root, and a new enterprise subordinate CA. Everything a

  • How to manage sequence number in PLD but not use LineNum()?

    Hi,All I want to show number in PLD. Probem, I can't use LineNum() because in some row in matrix that no price i will not show data. Now,if i use LineNum() when i print preview in column system will skip record that no have price. How to manage for g