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

Invalid default environment results in Rebuild IntelliSense index failure with obscure error message #2265

Closed
pfeerick opened this issue Mar 29, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@pfeerick
Copy link

commented Mar 29, 2019

What kind of issue is this?

  • PlatformIO Core.
    If you’ve found a bug, please provide information below.

Configuration

Operating system: Windows 10

PlatformIO Version (platformio --version): 3.6.6

Description of problem

If the environment set in env_default doesn't exist (i.e. was renamed), and you try to rebuild the intellisense index, it will fail with a NameError: name 'cc_flags' is not defined, rather than informing that the actual issue is an invalid default build environment.

Steps to Reproduce

  1. Have one more environments in your platformio.ini and a env_default.
  2. Change the name of the one set as default, or change the default to an invalid name
  3. Try to Rebuild IntelliSense Index and wait for the red...

Actual Results

IntelliSense rebuild appears to fail due to a misleading errror about a missing cc_flag definition.

Expected Results

Either accepts invalid configuration or preferably detects and informs of it.

If problems with PlatformIO Build System:

The content of platformio.ini:

[platformio]
env_default = uno3

[env:uno1]
platform = atmelavr
board = uno
framework = arduino

[env:uno2]
platform = atmelavr
board = uno
framework = arduino

Source file to reproduce issue:

#include <Arduino.h>

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

Additional info

> Executing task in folder new project: C:\Users\Peter\.platformio\penv\Scripts\platformio.exe init --ide vscode <


The current working directory c:\Users\Peter\Documents\PlatformIO\Projects\new project will be used for the project.

The next files/directories have been created in c:\Users\Peter\Documents\PlatformIO\Projects\new project
include - Put project header files here
lib - Put here project specific (private) libraries
src - Put project source files here
platformio.ini - Project Configuration File
Error: Traceback (most recent call last):
  File "c:\users\peter\.platformio\penv\lib\site-packages\platformio\__main__.py", line 120, in main
    cli(None, None, None)
  File "c:\users\peter\.platformio\penv\lib\site-packages\click\core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\peter\.platformio\penv\lib\site-packages\click\core.py", line 680, in main
    rv = self.invoke(ctx)
  File "c:\users\peter\.platformio\penv\lib\site-packages\click\core.py", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\peter\.platformio\penv\lib\site-packages\click\core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\peter\.platformio\penv\lib\site-packages\click\core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "c:\users\peter\.platformio\penv\lib\site-packages\click\decorators.py", line 16, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\users\peter\.platformio\penv\lib\site-packages\platformio\commands\init.py", line 102, in cli
    pg.generate()
  File "c:\users\peter\.platformio\penv\lib\site-packages\platformio\ide\projectgenerator.py", line 121, in generate
    self._render_tpl(tpl_path).encode("utf8"))
  File "c:\users\peter\.platformio\penv\lib\site-packages\platformio\ide\projectgenerator.py", line 127, in _render_tpl
    return bottle.template(content, **self._tplvars)
  File "c:\users\peter\.platformio\penv\scripts\bottle.py", line 3622, in template
    return TEMPLATES[tplid].render(kwargs)
  File "c:\users\peter\.platformio\penv\scripts\bottle.py", line 3411, in render
    self.execute(stdout, env)
  File "c:\users\peter\.platformio\penv\scripts\bottle.py", line 3398, in execute
    eval(self.co, env)
  File "<string>", line 56, in <module>
NameError: name 'cc_flags' is not defined

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

@ivankravets ivankravets added this to the 3.6.7 milestone Mar 29, 2019

@ivankravets ivankravets added the bug label Mar 29, 2019

ivankravets added a commit that referenced this issue Apr 18, 2019

@ivankravets

This comment has been minimized.

Copy link
Member

commented Apr 18, 2019

Thanks for the report!

@ivankravets ivankravets referenced this issue Apr 23, 2019

Closed

platformio 3.6.7 #39182

5 of 5 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.