无法导入我自己的文件python Flask pycharm

时间:2018-06-25 11:44:23

标签: python flask import pycharm

项目结构图片:

image of project structure

我有这种文件。我想通过write_blockblock.py中的main.py导入from block import *函数。

显示名称错误,并且write_block未定义。

1 个答案:

答案 0 :(得分:0)

尝试相对导入。

==14471== Conditional jump or move depends on uninitialised value(s) ==14471== at 0x4A0A965: memcpy (vg_replace_strmem.c:1023) ==14471== by 0x4E77C4B: as_command_parse_bins (as_command.c:985) ==14471== by 0x4E7805E: as_command_parse_result (as_command.c:1167) ==14471== by 0x4E787D2: as_command_execute (as_command.c:492) ==14471== by 0x4E6DF22: aerospike_key_get (aerospike_key.c:136) ==14471== by 0x4042D0: RtZonalDao::rtDispZonalCodes(char*, std::vector<RtDispRgZnCode, std::allocator<RtDispRgZnCode> >&) (RtZonalDao.cpp:90) ==14471== by 0x404679: RtZonalDao::rtAddRgZnCodeToList(RtRgZonalCodes*, char*) (RtZonalDao.cpp:370) ==14471== by 0x407665: RtZonalDaoTest::rtAdd() (RtZonalDaoTest.cpp:94) ==14471== by 0x403134: main (RtMain.cpp:194) ==14471== Uninitialised value was created by a stack allocation ==14471== at 0x4041A8: RtZonalDao::rtDispZonalCodes(char*, std::vector<RtDispRgZnCode, std::allocator<RtDispRgZnCode> >&) (RtZonalDao.cpp:24) ==14471== ==14471== Use of uninitialised value of size 8 ==14471== at 0x4A0A9AB: memcpy (vg_replace_strmem.c:1023) ==14471== by 0x4E77C4B: as_command_parse_bins (as_command.c:985) ==14471== by 0x4E7805E: as_command_parse_result (as_command.c:1167) ==14471== by 0x4E787D2: as_command_execute (as_command.c:492) ==14471== by 0x4E6DF22: aerospike_key_get (aerospike_key.c:136) ==14471== by 0x4042D0: RtZonalDao::rtDispZonalCodes(char*, std::vector<RtDispRgZnCode, std::allocator<RtDispRgZnCode> >&) (RtZonalDao.cpp:90) ==14471== by 0x404679: RtZonalDao::rtAddRgZnCodeToList(RtRgZonalCodes*, char*) (RtZonalDao.cpp:370) ==14471== by 0x407665: RtZonalDaoTest::rtAdd() (RtZonalDaoTest.cpp:94) ==14471== by 0x403134: main (RtMain.cpp:194) ==14471== Uninitialised value was created by a stack allocation ==14471== at 0x4041A8: RtZonalDao::rtDispZonalCodes(char*, std::vector<RtDispRgZnCode, std::allocator<RtDispRgZnCode> >&) (RtZonalDao.cpp:24) ==14471== ==14471== Invalid write of size 8 ==14471== at 0x4A0A9AB: memcpy (vg_replace_strmem.c:1023) ==14471== by 0x4E77C4B: as_command_parse_bins (as_command.c:985) ==14471== by 0x4E7805E: as_command_parse_result (as_command.c:1167) ==14471== by 0x4E787D2: as_command_execute (as_command.c:492) ==14471== by 0x4E6DF22: aerospike_key_get (aerospike_key.c:136) ==14471== by 0x4042D0: RtZonalDao::rtDispZonalCodes(char*, std::vector<RtDispRgZnCode, std::allocator<RtDispRgZnCode> >&) (RtZonalDao.cpp:90) ==14471== by 0x404679: RtZonalDao::rtAddRgZnCodeToList(RtRgZonalCodes*, char*) (RtZonalDao.cpp:370) ==14471== by 0x407665: RtZonalDaoTest::rtAdd() (RtZonalDaoTest.cpp:94) ==14471== by 0x403134: main (RtMain.cpp:194) ==14471== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==14471== ==14471== ==14471== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==14471== Access not within mapped region at address 0x0 ==14471== at 0x4A0A9AB: memcpy (vg_replace_strmem.c:1023) ==14471== by 0x4E77C4B: as_command_parse_bins (as_command.c:985) ==14471== by 0x4E7805E: as_command_parse_result (as_command.c:1167) ==14471== by 0x4E787D2: as_command_execute (as_command.c:492) ==14471== by 0x4E6DF22: aerospike_key_get (aerospike_key.c:136) ==14471== by 0x4042D0: RtZonalDao::rtDispZonalCodes(char*, std::vector<RtDispRgZnCode, std::allocator<RtDispRgZnCode> >&) (RtZonalDao.cpp:90) ==14471== by 0x404679: RtZonalDao::rtAddRgZnCodeToList(RtRgZonalCodes*, char*) (RtZonalDao.cpp:370) ==14471== by 0x407665: RtZonalDaoTest::rtAdd() (RtZonalDaoTest.cpp:94) ==14471== by 0x403134: main (RtMain.cpp:194) ==14471== If you believe this happened as a result of a stack ==14471== overflow in your program's main thread (unlikely but ==14471== possible), you can try to increase the size of the ==14471== main thread stack using the --main-stacksize= flag. ==14471== The main thread stack size used in this run was 10485760. ==14471== ==14471== HEAP SUMMARY: ==14471== in use at exit: 248,960 bytes in 70 blocks ==14471== total heap usage: 126 allocs, 56 frees, 260,256 bytes allocated Is there any problem in any part of the code I’ve provided above?

通过这种方式,您应该避免输入*。

如果您想了解有关导入的更多信息,只需看看PEP 328