aider icon indicating copy to clipboard operation
aider copied to clipboard

TypeError: replace() argument 1 must be str, not None

Open Senethys opened this issue 10 months ago • 2 comments

Aider v0.28.0 Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in run_code File "C:\Python312\Scripts\aider.exe_main.py", line 7, in File "C:\Python312\Lib\site-packages\aider\main.py", line 558, in main io.tool_output(map(scrub_sensitive_info, sys.argv), log_only=True) File "C:\Python312\Lib\site-packages\aider\main.py", line 547, in scrub_sensitive_info return text.replace(args.openai_api_key, "**") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: replace() argument 1 must be str, not None

I have successfully stored my API key using setx but I can't make this error go away.

Any ideas?

Using aider --open-api-key sk- gives the same error.

Senethys avatar Apr 14 '24 20:04 Senethys

Thanks for trying aider and filing this issue. I just pushed a fix. The change is available in the main branch. You can get it by installing the latest version from github:

python -m pip install --upgrade git+https://github.com/paul-gauthier/aider.git

If you have a chance to try it, let me know if it works better for you.

paul-gauthier avatar Apr 15 '24 19:04 paul-gauthier

Hey Paul (thanks for sharing this amazing project),

I confirm that upgrading to v0.28.1-dev solved the issue for me.

For some reason I needed to explicitely export the key ; when sourcing my .env file and trying to run Aider, it would simply print:

No OpenAI API key provided. Use --openai-api-key or export OPENAI_API_KEY.

and return

FS-CS avatar Apr 17 '24 09:04 FS-CS

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.

paul-gauthier avatar Apr 17 '24 16:04 paul-gauthier