EnvFile icon indicating copy to clipboard operation
EnvFile copied to clipboard

Empty environment variables on IntelliJ IDEA 2022.2 (Community Edition)

Open luiscoms opened this issue 3 years ago • 29 comments

I am getting empty environment variables on Python projects even I set a value after IntelliJ Update

IntelliJ IDEA 2022.2 (Community Edition)
Build #IC-222.3345.118, built on July 26, 2022
Runtime version: 17.0.3+7-b469.32 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.15.0-41-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 1960M
Cores: 8
Non-Bundled Plugins:
    Key Promoter X (2022.2)
    org.sonarlint.idea (6.8.0.50884)
    PythonCore (222.3345.118)
    ru.meanmail.plugin.requirements (2022.3-222-EAP-SNAPSHOT)
    net.ashald.envfile (3.2.2)
    ru.adelf.idea.dotenv (2022.2)
    izhangzhihao.rainbow.brackets (6.25)

Kotlin: 222-1.7.10-release-334-IJ3345.118
Current Desktop: ubuntu:GNOME

luiscoms avatar Jul 26 '22 22:07 luiscoms

Same issue is happening with IntelliJ IDEA 2022.2 (Ultimate Edition) as well.

IntelliJ IDEA 2022.2 (Ultimate Edition)
Build #IU-222.3345.118, built on July 26, 2022


Runtime version: 17.0.3+7-b469.32 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.3.1
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Metal Rendering is ON
Non-Bundled Plugins:
    org.rust.lang (0.4.175.4772-222)
    com.intellij.nativeDebug (222.3345.111)
    org.jetbrains.plugins.go (222.3345.118)
    com.jetbrains.lang.ejs (222.3345.108)
    com.intellij.plugins.html.instantEditing (222.3345.108)
    Pythonid (222.3345.118)
    net.ashald.envfile (3.2.2)
    com.leinardi.pycharm.pylint (0.14.0)
    org.intellij.scala (2022.2.10)
    com.cursiveclojure.cursive (1.12.4-2022.2)

Kotlin: 222-1.7.10-release-334-IJ3345.118

chrisbroome avatar Jul 27 '22 16:07 chrisbroome

Same here.

PyCharm 2022.2 (Community Edition)
Build #PC-222.3345.131, built on July 27, 2022
Runtime version: 17.0.3+7-b469.32 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.8.0-63-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 1994M
Cores: 12
Non-Bundled Plugins:
    org.jetbrains.intellij.scripting-javascript (1.0)
    org.intellij.plugins.hcl (222.3345.108)
    net.seesharpsoft.intellij.plugins.csv (2.19.0)
    name.kropp.intellij.makefile (222.3345.108)
    com.jetbrains.plugins.ini4idea (222.3345.108)
    com.intellij.ideolog (203.0.30.0)
    com.4lex4.intellij.solarized (2.4.0)
    mobi.hsz.idea.gitignore (4.4.2)
    net.ashald.envfile (3.2.2)
    com.y4kstudios.pytestimp (0.8.0)
    Docker (222.3345.118)
    ru.adelf.idea.dotenv (2022.2)
    Batch Scripts Support (1.0.13)

Current Desktop: ubuntu:GNOME

ghost avatar Jul 28 '22 15:07 ghost

Same for me.

PyCharm 2022.2 (Professional Edition)
Build #PY-222.3345.131, built on July 27, 2022
Licensed to Volodymyr Pivoshenko
Subscription is active until October 10, 2022.
Runtime version: 17.0.3+7-b469.32 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 11.6.7
GC: G1 Young Generation, G1 Old Generation
Memory: 3096M
Cores: 12
Metal Rendering is ON
Registry:
    debugger.watches.in.variables=false
    ide.balloon.shadow.size=0

Non-Bundled Plugins:
    uk.co.hadoopathome.intellij.avro.intellijavroviewer (3.0.0)
    socrates.tabshifter (0.30)
    org.rust.lang (0.4.175.4772-222)
    org.jetbrains.action-tracker (0.3.3)
    org.intellij.qodana (222.3345.108)
    org.ice1000.julia (0.4.2)
    net.sf.opk.avro-schema-support (213.1.0)
    net.seesharpsoft.intellij.plugins.csv (2.19.0)
    name.kropp.intellij.makefile (222.3345.108)
    lermitage.intellij.extratci (1.23.0.201)
    leetcode-editor (8.2)
    jms-messenger (2.0.1)
    indent-rainbow.indent-rainbow (2.0.2)
    idea.plugin.protoeditor (222.3345.108)
    de.docs_as_co.intellij.plugin.diagramsnet (0.1.12)
    com.wakatime.intellij.plugin (14.0.6)
    com.vecheslav.darculaDarkerTheme (1.2.0)
    com.mroche.JsonHelper (1.2.0)
    com.markskelton.one-dark-theme (5.6.0)
    org.intellij.plugins.hcl (222.3345.108)
    com.intellij.plugins.vscodekeymap (222.3345.111)
    com.intellij.plugins.macoskeymap (222.3345.108)
    com.intellij.javafx (1.0.4)
    com.intellij.ideolog (203.0.30.0)
    com.intellij.grpc (222.3345.108)
    com.intellij.apacheConfig (222.3345.108)
    com.github.patou.gitmoji (1.10.0)
    com.github.lppedd.idea-conventional-commit (0.21.0)
    com.github.balintrudas.avro-random-generator (1.0.2)
    com.4lex4.intellij.solarized (2.4.0)
    club.nutsoft.Github3Theme (1.1.9)
    appland.appmap (0.7.10)
    String Manipulation (9.5.0)
    Key Promoter X (2022.2)
    IdeaVIM (1.10.3)
    GrepConsole (12.14.211.6693.0)
    zielu.gittoolbox (212.9.7)
    mobi.hsz.idea.gitignore (4.4.2)
    com.mallowigi (65.1.0)
    PlantUML integration (5.16.1)
    com.intellij.lang.jsgraphql (3.2.1)
    com.intellij.queryComplexity (222.3345.108)
    org.asciidoctor.intellij.asciidoc (0.37.33)
    com.intellij.swagger (222.3345.108)
    ru.meanmail.plugins.prettify-python (2020.2-222-EAP-SNAPSHOT)
    ru.meanmail.plugin.requirements (2022.3-222-EAP-SNAPSHOT)
    org.jfrog.idea (1.16.0)
    net.ashald.envfile (3.2.2)
    izhangzhihao.rainbow.brackets (6.25)
    com.intellij.bigdatatools (222.3048.12)
    com.google.idea.bazel.ijwb (2022.07.25.0.1-api-version-222)
    com.github.copilot (1.1.28.1744)
    R4Intellij (222.3345.118)
    ru.adelf.idea.dotenv (2022.2)
    aws.toolkit (1.48-222)

pivoshenko avatar Jul 29 '22 10:07 pivoshenko

@ashald

Same.

I have a stack trace:

image

stack trace
java.lang.Throwable: Assertion failed: dataContext has no component for new ListPopupStep
	at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:220)
	at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.createStep(PopupFactoryImpl.java:251)
	at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.<init>(PopupFactoryImpl.java:209)
	at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.<init>(PopupFactoryImpl.java:176)
	at com.intellij.ui.popup.PopupFactoryImpl.createActionGroupPopup(PopupFactoryImpl.java:341)
	at net.ashald.envfile.platform.ui.EnvFileConfigurationPanel.doAddAction(EnvFileConfigurationPanel.java:244)
	at net.ashald.envfile.platform.ui.EnvFileConfigurationPanel.access$600(EnvFileConfigurationPanel.java:38)
	at net.ashald.envfile.platform.ui.EnvFileConfigurationPanel$4.run(EnvFileConfigurationPanel.java:109)
	at net.ashald.envfile.platform.ui.EnvFileConfigurationPanel$4.run(EnvFileConfigurationPanel.java:106)
	at com.intellij.ui.ToolbarDecorator$3.doAdd(ToolbarDecorator.java:535)
	at com.intellij.ui.CommonActionsPanel$AddButton.actionPerformed(CommonActionsPanel.java:315)
	at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:190)
	at com.intellij.openapi.actionSystem.impl.ActionButton.lambda$performAction$0(ActionButton.java:166)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:337)
	at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:166)
	at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:465)
	at java.desktop/java.awt.Component.processEvent(Component.java:6413)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5022)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2802)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:754)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:752)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:751)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898)
	at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:820)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:743)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:121)
	at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:191)
	at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:236)
	at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:234)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
	at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:234)
	at java.desktop/java.awt.Dialog.show(Dialog.java:1080)
	at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:712)
	at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:453)
	at com.intellij.openapi.ui.DialogWrapper.doShow(DialogWrapper.java:1672)
	at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1630)
	at com.intellij.execution.actions.EditRunConfigurationsAction.actionPerformed(EditRunConfigurationsAction.java:27)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.java:315)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performActionDumbAwareWithCallbacks$4(ActionUtil.java:294)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:337)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAwareWithCallbacks(ActionUtil.java:294)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.invokeAction(ActionUtil.java:516)
	at com.intellij.ui.popup.ActionPopupStep.performAction(ActionPopupStep.java:232)
	at com.intellij.ui.popup.ActionPopupStep.lambda$onChosen$1(ActionPopupStep.java:220)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
	at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94)
	at com.intellij.ui.popup.AbstractPopup.lambda$dispose$18(AbstractPopup.java:1543)
	at com.intellij.util.ui.EdtInvocationManager.invokeLaterIfNeeded(EdtInvocationManager.java:113)
	at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:179)
	at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:132)
	at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:163)
	at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1540)
	at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:162)
	at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:326)
	at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.dispose(PopupFactoryImpl.java:266)
	at com.intellij.openapi.util.ObjectTree.runWithTrace(ObjectTree.java:126)
	at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:158)
	at com.intellij.openapi.util.Disposer.dispose(Disposer.java:217)
	at com.intellij.openapi.util.Disposer.dispose(Disposer.java:205)
	at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:266)
	at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:434)
	at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:406)
	at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:361)
	at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.handleSelect(PopupFactoryImpl.java:278)
	at com.intellij.ui.popup.list.ListPopupImpl$MyMouseListener.mouseReleased(ListPopupImpl.java:618)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6648)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3392)
	at com.intellij.ui.popup.list.ListPopupImpl$MyList.processMouseEvent(ListPopupImpl.java:694)
	at java.desktop/java.awt.Component.processEvent(Component.java:6413)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5022)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2802)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:754)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:752)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:751)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898)
	at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:820)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:743)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

wb7777 avatar Jul 29 '22 11:07 wb7777

Same error here

leandrorebelo avatar Jul 29 '22 19:07 leandrorebelo

Having the same error.

robertosegura avatar Jul 29 '22 20:07 robertosegura

Existing feature request for making this a native feature of the IDE:

https://youtrack.jetbrains.com/issue/IDEA-137820 https://youtrack.jetbrains.com/issue/PY-5543

sepbot avatar Jul 30 '22 00:07 sepbot

oof. ... Those feature requests are 11 and 7 years old respectively.

Cabalist avatar Jul 30 '22 21:07 Cabalist

@ashald

Same.

I have a stack trace:

image stack trace

This issue is fixed in the master branch of this repo (see https://github.com/ashald/EnvFile/pull/158 ), which has not yet been published. You can install it by building from source and adding the plugin from the generated zip file.

I have tried it and the issue of empty env vars persists, which means it unfortunately is not related to this exception and there is no fix available yet... 😞

ebarti avatar Jul 31 '22 10:07 ebarti

I'm not a user of the EnvFile plugin, but I'm subscribed to updates on PY-5543 and I saw a comment about the recent version incompatibility.

For EnvFile users with simple .env files, in key=value format, patch-env might be a good work-around until this plugin gets updated. pip install patch-env and set PATCH_ENV_COMMAND in your run config to a command whose output declares all the environment variables you want in your Python process's environment.

PATCH_ENV_COMMAND="cat first.env second.env"

patch-env doesn't do environment variable substitution or support or other input formats, but it will run any command you specify to get its input, so you can be creative with how the variable data gets assembled.

sterwill avatar Jul 31 '22 13:07 sterwill

For those wanting to employ then patch_env solution with an env file local to your script/module path, you can use something like this:

PATCH_ENV_COMMAND=cat $(pwd)/.env

KhanMechAI avatar Aug 01 '22 08:08 KhanMechAI

@KhanMechAI Use: grep -Ev '(#|^$)' $env_file_name to skip comments and empty lines in the env file.

mousomer avatar Aug 01 '22 17:08 mousomer

For me, installing Pycharm Professional 2021.3.3 fixed the issue. You can do it here https://www.jetbrains.com/pycharm/download/other.html I am running a Mac with Apple silicon

larrykooper avatar Aug 04 '22 17:08 larrykooper

@larrykooper degrading of your PyCharm version is not the issue fix

OlehChyhyryn avatar Aug 09 '22 08:08 OlehChyhyryn

@ashald Is this project being maintained? Is there a fix for this issue on the horizon?

SpudInNZ avatar Aug 14 '22 22:08 SpudInNZ

@ashald previous time fix took a lot of time. So it's rarely supported

OlehChyhyryn avatar Aug 15 '22 08:08 OlehChyhyryn

Same here :(

youssefmzouri avatar Aug 23 '22 10:08 youssefmzouri

Same issue here

dehidehidehi avatar Aug 23 '22 16:08 dehidehidehi

@KhanMechAI Use: grep -Ev '(#|^$)' $env_file_name to skip comments and empty lines in the env file.

Here's a bash script which would allow to easily concatenate the contents of multiple .env files. Just save this script and pass the .env file path (relative or absolute) as arguments.

#!/bin/bash
# Documentation here :
# https://gist.github.com/dehidehidehi/6c92f618e4d841e6cc8b2dce8a3b0b7d
# Here's a bash script which would allow to easily concatenate the contents of multiple .env files.
# Just save this script and pass the .env file path (relative or absolute) as arguments.

ENV_VARS_LIST=""
for envFile in $@
do
  grep -Ev '(#|^$)' $envFile
done

# Credits:
# The base idea for this script is credited to 
# https://github.com/sterwill  
# Grep idea is credited to
# https://github.com/mousomer

Examples usage: patchEnvProvider.sh envfile1.sh envfile2.sh envfile3.sh

Here's the link to the gist in case I update the code. https://gist.github.com/dehidehidehi/6c92f618e4d841e6cc8b2dce8a3b0b7d

dehidehidehi avatar Aug 23 '22 21:08 dehidehidehi

Got same issue in PyCharm 2022.2.1 Professional Edition.

Build #PY-222.3739.56, built on August 16, 2022

Runtime version: 17.0.3+7-b469.37 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

It worked before IDE update, but now I get empty env variables in any existing/new run configurations.

Astro1247 avatar Aug 26 '22 16:08 Astro1247

Same issue, PyCharm 2022.2.1 Pro. I used to have shell automation for changing environment files and everything would run smoothly. Now I'm flooded with hand updated configuration profiles that constantly get out of date.

sherghan avatar Aug 30 '22 09:08 sherghan

@ashald Do you plan to fix this issue or is this project abandoned already?

wizardion avatar Aug 30 '22 17:08 wizardion

@ashald are u planning to fix this?

Thorbenl avatar Aug 31 '22 15:08 Thorbenl

I can't quite figure out why it's broken, but I managed to get the plugin working in pycharm using an experimental internal API. Releases here | Diff | CI for the release


Notes for developers: Using the EP above means it builds, and works for IDE version 2022.2, but it might break in the future. I pushed the changes to my fork and I'm trying to get it to work for the other IDEs. For those who'd like to debug, the EP used in the idea portion doesn't seem to exist anymore, but the people in the slack assured me it still does 🤷. For the other IDEs, they use a separate EP which is still accessible, but for some reason, the patchCommandLine method is no longer called. I brought up both of these issues in the slack here, but I'm still struggling to get help.

Small update: I managed to find from the Go EP that the patchCommandLine method is actually deprecated, though that isn't marked on the base class that all these EPs inherit from, nor is it marked on the python EP. No alternative is proposed. The most consistent thing about the intellij plugin platform is how terrible an experience it is.

HassanAbouelela avatar Aug 31 '22 15:08 HassanAbouelela

@HassanAbouelela thank you so much for this. Really looking forward to a stable solution.

RockyMM avatar Sep 06 '22 16:09 RockyMM

Follow up: I have some bad news, and some good news. I asked on the slack again, and this time I got confirmation that this is in fact a bug! This most likely means that the plugin will not work in 2022.2 (unless we find other workarounds like the one for pycharm).

The good news is that this is a bug, and hopefully will be fixed or we'll get an alternative. I'll update this issue with a YouTrack issue later.

HassanAbouelela avatar Sep 06 '22 16:09 HassanAbouelela

degrading of your PyCharm version is not the issue fix

@olegchigirin but it provides a very use-able workaround for the time-being though. and its pretty easy to change what version you are using with the toolbox

modernNeo avatar Sep 06 '22 23:09 modernNeo

Youtrack: https://youtrack.jetbrains.com/issue/PY-56172/RunConfigurationpatchCommandLine-Not-Called-In-20222

There's a lot of templates to choose from here, lets hope this was reported correctly, and to have a fix in the next version 😅.

HassanAbouelela avatar Sep 07 '22 18:09 HassanAbouelela

FWIW, I'm using the following pycharm build:

PyCharm 2022.2.2 (Professional Edition)
Build #PY-222.4167.33, built on September 15, 2022
Runtime version: 17.0.4+7-b469.53 amd64
...
Non-Bundled Plugins:
    ...
    net.ashald.envfile (3.2.4)
    ...

And this v3.2.4 release of the plugin from @HassanAbouelela appears to work. Many thanks for this stopgap!

ghukill avatar Sep 16 '22 11:09 ghukill

FYI @HassanAbouelela 's 3.2.4 appears to work on Python modules with IDEA too, although I do get some noisy errors thrown presumably since the idea implementation is commented out in build.gradle

Caused by: java.lang.ClassNotFoundException: net.ashald.envfile.products.idea.IdeaRunConfigurationExtension PluginClassLoader(plugin=PluginDescriptor(name=EnvFile, id=net.ashald.envfile, descriptorPath=plugin.xml, path=~/.local/share/JetBrains/IntelliJIdea2022.2/EnvFile, version=3.2.4, package=null, isBundled=false), packagePrefix=null, instanceId=363, state=active)

voneiden avatar Sep 19 '22 09:09 voneiden