This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Bruce Eckel
Recipients Bruce Eckel, tim.peters
Date 2016-07-21.21:09:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1469135383.97.0.714850033855.issue27586@psf.upfronthosting.co.za>
In-reply-to
Content
Sorry, I thought maybe the error message would be indicative of something. Here's the re:

find_output = re.compile(r"/\* (Output:.*)\*/", re.DOTALL)

Here's the program:

#! py -3
# Requires Python 3.5
# Updates generated output into extracted Java programs in "On Java 8"
from pathlib import Path
import re
import pprint
import sys

if __name__ == '__main__':
    find_output = re.compile(r"/\* (Output:.*)\*/", re.DOTALL)
    for outfile in Path(".").rglob("*.p1"):
        print(str(outfile))
        javafile = outfile.with_suffix(".java")
        if not javafile.exists():
            print(str(outfile) + " has no javafile")
            sys.exit(1)
        javatext = javafile.read_text()
        if "/* Output:" not in javatext:
            print(str(javafile) + " has no /* Output:")
            sys.exit(1)
        new_output = outfile.read_text()
        new_javatext = find_output.sub(new_output, javatext)
        javafile.write_text(new_javatext)
History
Date User Action Args
2016-07-21 21:09:44Bruce Eckelsetrecipients: + Bruce Eckel, tim.peters
2016-07-21 21:09:43Bruce Eckelsetmessageid: <1469135383.97.0.714850033855.issue27586@psf.upfronthosting.co.za>
2016-07-21 21:09:43Bruce Eckellinkissue27586 messages
2016-07-21 21:09:43Bruce Eckelcreate