selfteaching / selfteaching/selfteaching-python-camp

Day07 关于导入模块后代码运行方式问题

Open
#2,261 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
151
Forks
875
PR merge metrics
No merged PRs in 30d

Description

在day7——“通过模块导入stats_word,调用stats_text函数统计字符出现次数”的作业中,在代码运行过程中发现,使用terminal代码运行成功(运行方式:run Python file in terminal),输出正确结果。但是,在Python interactive 中运行显示ModuleNotFoundError:No module named 'stats_word'.(运行方式为Shift + Enter)
在day10“使用request请求微信文章链接,并获取返回结果(response)”的作业中,则出现相反的结果,即获取文章的代码可以在Python interactive 中实现(可输出文章内容,以此判断代码运行成功),在terminal中出现错误【requests.exceptions.SSLError: HTTPSConnectionPool(host='mp.weixin.qq.com', port=443): Max retries exceeded with url: /s/pLmuGoc4bZrMNl7MSoWgiA (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))】

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the Python interpreter and launch context used by the terminal and Python interactive modes for the day7 stats_word/stats_text assignment. Reproduce the day10 requests call in both modes and investigate the reported ModuleNotFoundError and unavailable SSL module; done means identifying the environment difference and documenting or correcting the affected run instructions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.