On 05/03/2016 08:14, jf...@ms4.hinet.net wrote:
Chris Angelico at 2016/3/5  UTC+8 1:50:05PM wrote:
Your conclusion may well be correct. However, the exact issue you're
looking at here might be easily enough fixed; it looks like it's
trying to sort things by length, so you can simply use "key=len" (and
maybe "reverse=True").

After Chris gave this suggestion, I can't withstand the temptation of running the setup again. This 
time, strangely, it reports error on import. Won't the import statement easy enough to be handled 
by 2To3? Here is the result (where the whole "ctypesgencore" directory had been processed 
by 2To3 and the "parser" is a sub-directory under it):

----------
D:\Patch\ctypesgen-master>python setup.py install
Traceback (most recent call last):
   File "setup.py", line 13, in <module>
     import ctypesgencore
   File "D:\Patch\ctypesgen-master\ctypesgencore\__init__.py", line 55, in 
<modul
e>
     from . import parser
   File "D:\Patch\ctypesgen-master\ctypesgencore\parser\__init__.py", line 17, 
in
  <module>
     from .datacollectingparser import DataCollectingParser
   File 
"D:\Patch\ctypesgen-master\ctypesgencore\parser\datacollectingparser.py",
  line 10, in <module>
     from . import ctypesparser
   File "D:\Patch\ctypesgen-master\ctypesgencore\parser\ctypesparser.py", line 
15
, in <module>
     from .cparser import *
   File "D:\Patch\ctypesgen-master\ctypesgencore\parser\cparser.py", line 21, in
<module>
     from . import cgrammar
   File "D:\Patch\ctypesgen-master\ctypesgencore\parser\cgrammar.py", line 25, 
in
  <module>
     from . import ctypesparser
ImportError: cannot import name 'ctypesparser'
------------

Just curious, is there a recursive-import happen on handling the "parser" 
directory?

After checking the files, I had noticed that all the import statements had been changed by 2To3. Mostly the changes 
are, such as, from "import cgrammar" to "from . import cgrammar", or "from cparser import 
*" to "from .cparset import *". I can understand the former, but can't figure out the latter:-(

--Jach


HTH http://python3porting.com/problems.html

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to