Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ModuleNotFoundError when running reqable script directly #1

Merged
merged 3 commits into from
Jun 23, 2024

Conversation

cesaryuan
Copy link
Contributor

@cesaryuan cesaryuan commented Jun 16, 2024

修复直接运行reqable脚本时的报错:

Traceback (most recent call last):
  File "c:\Users\xxxx\AppData\Roaming\Reqable\scripts\62d7f01d-31a4-4483-be8e-e665159eb48f\addons.py", line 3, in <module>
    from reqable import *
  File "D:\scoop\apps\miniconda3\current\envs\reqable\lib\site-packages\reqable\__init__.py", line 1, in <module>
    import main
ModuleNotFoundError: No module named 'main'

什么情况下要直接运行reqable脚本:

  1. reqable脚本和mitmproxy脚本共用一套代码
  2. 利用VSCode编写reqable脚本时,需要不断调试来检测某些函数是否编写正确

@MegatronKing
Copy link
Member

感谢提交。

reqable/__init__.py这个修改没有问题,但是其他几个文件的修改会导致无法集成到目前的Reqable项目中。另外,addon.py里面我觉得最好保持 import *,你不知道用户在脚本里面用到了哪些函数或者类,一是没法兼容,二是写起来也费事。

@cesaryuan
Copy link
Contributor Author

感谢提交。

reqable/__init__.py这个修改没有问题,但是其他几个文件的修改会导致无法集成到目前的Reqable项目中。另外,addon.py里面我觉得最好保持 import *,你不知道用户在脚本里面用到了哪些函数或者类,一是没法兼容,二是写起来也费事。

嗯嗯,重新提交了下,现在的修改应该是最简单的解决这个问题的方法

@cesaryuan
Copy link
Contributor Author

大佬空了看看现在的修改有没有什么问题

@cesaryuan
Copy link
Contributor Author

滴滴

@MegatronKing
Copy link
Member

非常抱歉,忘记这个事情了。

@MegatronKing MegatronKing merged commit 81285a4 into reqable:main Jun 23, 2024
@cesaryuan cesaryuan deleted the fix branch June 26, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants