作者查詢 / rebellionyu

總覽項目: 發文 | 留言 | 暱稱
作者 rebellionyu 在 PTT [ Python ] 看板的留言(推文), 共14則
限定看板:Python
首頁
上一頁
1
下一頁
尾頁
[問題] 資料夾結構問題
[ Python ]22 留言, 推噓總分: 0
作者: rebellionyu - 發表於 2017/03/20 16:08(8年前)
5Frebellionyu: 我剛剛測試了一下,放在tests/unit/test.py,03/20 18:34
6Frebellionyu: 要用python -m unittest tests.unit.test 跑03/20 18:35
7Frebellionyu: 而test.py只要from weatherParser import weather03/20 18:35
8Frebellionyu: 但如果直接跑 python ./tests/unit/test.py 就不行03/20 18:36
9Frebellionyu: 會說找不到weatherParser這個module03/20 18:36
14Frebellionyu: 我後來的測試,bot資料夾裡面長這樣03/23 14:46
15Frebellionyu: http://imgur.com/a/hQ4WV03/23 14:47
16Frebellionyu: 我在bot資料夾裡,python tests/unit/test_weather_03/23 14:47
17Frebellionyu: parser.py,而此py檔from ...weather_parser import03/23 14:48
18Frebellionyu: 會出現此error ValueError: attempted relative03/23 14:49
19Frebellionyu: import beyond top-level package03/23 14:49
20Frebellionyu: 照理說我的sys.path應該是 /unit,那我用...weather_03/23 14:49
21Frebellionyu: parser應該要可以才是…03/23 14:50
[問題] Import module to open file
[ Python ]7 留言, 推噓總分: +1
作者: rebellionyu - 發表於 2017/02/09 11:03(9年前)
4Frebellionyu: 好,謝謝各位的回答!02/09 12:32
首頁
上一頁
1
下一頁
尾頁