patman: ImportError

Stefan Bosch stefan_b at posteo.net
Sun May 17 15:55:15 CEST 2020


Hi Simon,

Am 17.05.20 um 01:03 schrieb Simon Glass:
> Hi Stefan,
> 
> On Sat, 16 May 2020 at 05:27, Stefan Bosch <stefan_b at posteo.net> wrote:
>>
>> Hello,
>>
>> recently, I updated my local repository (U-Boot master). Last commit is
>> c693f212c5b0433b3a49a89d87cbff28bf78eb87 now. Previously it has been
>> 4df3578119b043d76b86b50077b06898fc2a4f62 (Date:   Wed Dec 18 18:25:42
>> 2019 +0100).
>>
>> Now I get an "ImportError" if I call patman:
>>
>> u-boot_master$ ./tools/patman/patman --help
>> Traceback (most recent call last):
>>     File "./tools/patman/patman", line 21, in <module>
>>       from patman import checkpatch
>>     File
>> "/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line
>> 10, in <module>
>>       from patman import command
>>     File "/home/stefan/u-boot_master/tools/patman/../patman/command.py",
>> line 8, in <module>
>>       from patman import tools
>>     File "/home/stefan/u-boot_master/tools/patman/../patman/tools.py",
>> line 13, in <module>
>>       from patman import command
>> ImportError: cannot import name 'command'
>>
>> Cause of this 'ImportError' is probably that "from patman import
>> command" has already been done before in checkpatch.py (circular
>> dependency). I think the error has to do with your your commit
>> bf776679a73f3b9eae37aabd2be5754483039cb2 (patman: Move to absolute imports).
>>
>> My Python version is 3.4.3.
> 
> The circular dependency has been there for some time, but perhaps in
> Python 2, not Python 3. My Python is 3.6.9 or 3.7.7.
> 
> I sent a patch to break the circular dependency. Can you please try it
> and see if it helps?
> 
> Regards,
> Simon
> 

Thanks for your quick reply. I tried your patch, the good news is that 
the ImportError for 'command' has been gone. The bad news is that the 
same occurs for 'checkpatch' now:

$ ./tools/patman/patman --help
Traceback (most recent call last):
   File "./tools/patman/patman", line 21, in <module>
     from patman import checkpatch
   File 
"/home/stefan/u-boot_master/tools/patman/../patman/checkpatch.py", line 
11, in <module>
     from patman import gitutil
   File "/home/stefan/u-boot_master/tools/patman/../patman/gitutil.py", 
line 10, in <module>
     from patman import checkpatch
ImportError: cannot import name 'checkpatch'

Regards,
Stefan


More information about the U-Boot mailing list