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 terry.reedy
Recipients benjamin.peterson, imz, python-dev, terry.reedy
Date 2016-05-06.20:38:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1462567096.12.0.644351489115.issue26911@psf.upfronthosting.co.za>
In-reply-to
Content
(Import errors are runtime errors, not compile errors.)

After 'import lib2to3.pgen2', 'pgen2' in the code would not be valid.  A 'from' import is needed instead.  I fixed the import for 3.5/6 (but not 2.7), but the file still does not run.

  File "F:\Python\dev\35\lib\lib2to3\tests\pytree_idempotency.py", line 27, in main
    gr = driver.load_grammar("Grammar.txt")
 ,,,
FileNotFoundError: [Errno 2] No such file or directory: 'Grammar.txt'

After fixing this with

 def main():
-    gr = driver.load_grammar("Grammar.txt")
+    gfile = os.path.dirname(os.path.dirname(__file__)) + "/Grammar.txt"
+    gr = driver.load_grammar(gfile)
     dr = driver.Driver(gr, convert=pytree.convert)
 
the file fails with

FileNotFoundError: [Errno 2] No such file or directory: 'example.py'

There is no 'example.py in lib2to3.  The closest is lib2to3/tests/data/fixers/parrot_example.py.  At this point, I leave it Benjamin to fix the file so it runs or delete it.

The file is not used anywhere since it is not part of the regular test suite (that would require the name to begin with 'test_').  It was meant to be run as a test by itself -- see the doc string.  Perhaps the completion of 2to3 and the test suite made it obsolete.
History
Date User Action Args
2016-05-06 20:38:16terry.reedysetrecipients: + terry.reedy, benjamin.peterson, python-dev, imz
2016-05-06 20:38:16terry.reedysetmessageid: <1462567096.12.0.644351489115.issue26911@psf.upfronthosting.co.za>
2016-05-06 20:38:16terry.reedylinkissue26911 messages
2016-05-06 20:38:15terry.reedycreate