开发者

Python 3 relative path conversion issue

开发者 https://www.devze.com 2022-12-23 07:52 出处:网络
I am currently working with converting Pycrypto over to Python 3.X Whilst I seem to have the cryptography side working the same cannot be said for the tests

I am currently working with converting Pycrypto over to Python 3.X

Whilst I seem to have the cryptography side working the same cannot be said for the tests provided with the module :(

I have used the tests under Python 2.64 and all works fine. I then ran '2to3' over the tests to generate new files in 3.X format. There are several references to the following:

from .common import make_block_tests

Whe开发者_开发问答never I run the tests I get:

ValueError: Attempted relative import in non-package

If someone would point me towards a way to fix this it would be much appreciated :)

Cheers Grail


You are trying to run the test files directly, then you can't have relative imports. Change them to be absolute imports, and it will solve the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消