簡體   English   中英

python - 子進程長度限制

[英]python - subprocess length limit

我必須從python腳本創建一個電子郵件,調用:

subprocess.call([
    'thunderbird',
    '-compose',
    "preselectid='{}',to='{}',cc='{}',subject='{}',body='{}'".format(
        preselectid, to, cc, subject, body),
    ])

但是當body “太大”時,電子郵件會被截斷。

我知道在Windows上有一個限制為32,768個字符( args參數的subprocess.Popen最大長度是多少? )但是我在Linux上(使用zsh)並在回顯字符串時

subprocess.call([
    'echo',
    "preselectid='{}',to='{}',cc='{}',subject='{}',body='{}'".format(
        preselectid, to, cc, subject, body),
    ])

我收到完整正確的電子郵件內容。

我怎么解決這個問題?

編輯:感謝@slezica我發現復制粘貼生成的電子郵件並從命令行運行命令我得到了,無論如何,截斷的電子郵件(在32,303字符處)。 問題是thunderbird

這是准答案。

打開錯誤報告( https://bugzilla.mozilla.org/show_bug.cgi?id=1329312 )后,我被告知Thunderbird的開發人員

implemented an option where you can read the message from a file with message=, see bug 882104. That will be shipping in TB 52, so you could use this now in Earlybird.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM