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

Empty environment variables on IntelliJ IDEA 2022.2 (Community Edition) #185

Closed
luiscoms opened this issue Jul 26, 2022 · 66 comments
Closed

Comments

@luiscoms
Copy link

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
@chrisbroome
Copy link

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

@ghost
Copy link

ghost commented Jul 28, 2022

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

@pivoshenko
Copy link

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)

@wb7777
Copy link

wb7777 commented Jul 29, 2022

@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)

@leandrorebelo
Copy link

Same error here

@robertosegura
Copy link

Having the same error.

@sepbot
Copy link

sepbot commented Jul 30, 2022

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

@Cabalist
Copy link

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

@ebarti
Copy link

ebarti commented Jul 31, 2022

@ashald

Same.

I have a stack trace:

image
stack trace

This issue is fixed in the master branch of this repo (see #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... 😞

@sterwill
Copy link

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.

@KhanMechAI
Copy link

KhanMechAI commented Aug 1, 2022

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

@mousomer
Copy link

mousomer commented Aug 1, 2022

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

@larrykooper
Copy link

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

@OlehChyhyryn
Copy link

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

@SpudInNZ
Copy link

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

@OlehChyhyryn
Copy link

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

@youssefmzouri
Copy link

Same here :(

@dehidehidehi
Copy link

Same issue here

@dehidehidehi
Copy link

dehidehidehi commented Aug 23, 2022

@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

@Astro1247
Copy link

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.

@sherghan
Copy link

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.

@wizardion
Copy link

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

@Thorbenl
Copy link

@ashald are u planning to fix this?

@HassanAbouelela
Copy link

HassanAbouelela commented Aug 31, 2022

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.

@RockyMM
Copy link

RockyMM commented Sep 6, 2022

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

@HassanAbouelela
Copy link

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.

@ashald
Copy link
Owner

ashald commented Sep 22, 2022

It's exciting to see how many people use the plugin judging from the number of complaints about it breaking. I wish it correlated with number of Github Sponsor donations to support plugin development. Or at least with a number of pull requests contributing fixes.

I personally don't have a need to use the latest version of IDE and been perfectly fine using older versions, though as I plan to add few extra features I'll look into fixing compatibility with the latest versions.

@modernNeo
Copy link

@ashald I can't speak for anyone else but I personally would be willing to support you financially with Paypal if you had one linked on your profile. 😄 Can't deny your plugin has been very helpful with my Pycharm usage

@wooyek
Copy link

wooyek commented Sep 26, 2022

Sponsor here > https://github.com/sponsors/ashald

PS. @ashald please setup One-time tiers :)

@Elizaveta239
Copy link

Hi @ashald! Thank you for creating such a popular plugin! I work at JetBrains and we'll be happy to provide a pull request to fix 2022.2 compatibility! (we had a huge refactoring in the 2022.2 release and most likely that was the reason of the broken plugin). Unfortunately, we didn't notice it earlier.

Would you be interested in such pull request? (asking just to make sure you're not working on it at the moment, so we won't do the same job twice)

@RockyMM
Copy link

RockyMM commented Sep 27, 2022

@ashald I am sorry, but it looked like you abandoned the repo. I am using @HassanAbouelela's fork at the moment.

@ALERTua

This comment was marked as abuse.

@thelfensdrfer

This comment was marked as abuse.

@Elizaveta239
Copy link

We have plans to implement this functionality as part of the product but later. Implementing a fix for the existing popular plugin is the fastest solution we can provide at the moment. Sorry for the inconvenience!

@wooyek
Copy link

wooyek commented Sep 28, 2022

Maybe you could just pay the authors to support the plugins and keep them in the loop for breaking changes.

The practice of using community contributors for free to discover what features are in demand, and them discarding their work in favor of internal implementations is questionable.

I guess you are the ones that should setup a sponsorship on @ashald account ;P

@HassanAbouelela
Copy link

I think this change would've been apparent in early builds of 2022.2 but there definitely could've been more done to communicate any of this.

The refactoring was not documented anywhere to my knowledge, and not listed in the breaking changes list. The APIs are still accessible and documented, despite being unable to access them for some IDEs (IntelliJ). They are also inconsistently documented, with some of the APIs marking certain methods as deprecated (Go deprecated the function this plugin uses, but none of the other EPs nor the base EP have the same deprecation). I also heard about a new run API in the slack community, but I'm honestly not sure where that is.

(This is more feedback for plugins and documentation in general, not for plugin developers).

@modernNeo
Copy link

We have plans to implement this functionality as part of the product but later. Implementing a fix for the existing popular plugin is the fastest solution we can provide at the moment. Sorry for the inconvenience!

@Elizaveta239 just to clarify, you mean essentially make this plugin unnecessary?

@ashald
Copy link
Owner

ashald commented Sep 30, 2022

@modernNeo thanks, noted - will update profile/readme to include links just in case you or anyone else would be feeling like doing so. 😊

@wooyek done!

@Elizaveta239 would appreciate a contribution! Please note I pushed some changes to update some of the dependencies. Also, would appreciate if you could clarify if the changes are only required for PyCharm, or if we should migrate to some new API for other platforms such as Goland/RubyMine.

And of course if such functionality would make make its way into JetBrains IDEs natively, I'd be more than happy to deprecate this plugin. Thought, IMHO, the best thing JetBrains could do is address https://youtrack.jetbrains.com/issue/IDEA-288756 so that not any developer willing to implement a plugin to add extra environment variables would have a cross-platform way to do so.

@RockyMM glad you found something that works for you! That being said, looking at your profile, you seem to have quite a few Java repos... which makes me wonder what stops people like you from contributing fixes rather than just commenting on issues like this, It's OSS after all.

@HassanAbouelela agree! the most challenging part of developing this plugin was to reverse-engineer ambiguous parts of plugin interface for run configurations.

@RockyMM
Copy link

RockyMM commented Sep 30, 2022

@ashald Borys, that's not fair. I have a fair share of contributions to OSS - Liquibase, openapi-generator. I am in a position where my free time is extremely limited. I think that given my free time I gave back to the community.

I only took a quick look at this repo and saw open PRs from 2020. It really felt neglected. I know this plugin is fully OSS, but I did not feel it would be right that anyone ports Hassan's solution back upstream, even more so as the probability of you approving the PR seemed so small.

@modernNeo
Copy link

modernNeo commented Sep 30, 2022

@RockyMM

I am in a position where my free time is extremely limited.

For all we know @ashald's time is even more limited than yours and they have already expressed the fact that they are not being supported as much as they need to be financially by the users of this plugin [myself included], couple that with the fact that this is OSS, it's par for the course imo for an OSS repo to sometimes feel abandoned.

@ashald
Copy link
Owner

ashald commented Sep 30, 2022

To be clear, I didn't mean to pick on anyone personally - apologies if that was an impression.

What I'm saying is that when I see a person with exclusive background in e.g. Python commenting on the issue like this, I have no questions whatsoever as they simply may lack expertise in Java to contribute a fix. When I see a person with lots of repos in Java, I'd imagine nothing really stops them from trying to debug an issue on their own. Well, except the lack of time or real interest in that thing working.

And I must be fair: I did have few contributions when people saw things broken and submitted a PR to fix them, but I'm wondering about that fuzzy state in which "it's annoying enough to comment on a ticket, but not annoying enough to contribute a fix despite having relevant expertise."

@ashald
Copy link
Owner

ashald commented Oct 2, 2022

FWIW, I pushed fixes into the develop branch.
I plan to include few extra small fixes and release a new version coming week. Stay tuned.

@HassanAbouelela
Copy link

Glad to see things are still picking up steam here! I've gone ahead and added notices to my fork telling people to head back here. If you had installed one of my releases, and would like to go back, just uninstall, and reinstall directly from the plugin marketplace once it's available there.

@mrworkman
Copy link

Lol, was just about to open a pull request with fixes for Idea and PyCharm... oh well, learned a lot about JetBrains plugins 😆

@ashald
Copy link
Owner

ashald commented Oct 2, 2022

@mrworkman what did you plan to fix for IDEA? I was under impressions it works fine.

@ashald
Copy link
Owner

ashald commented Oct 2, 2022

OK, whatever, cut a new release https://github.com/ashald/EnvFile/releases/tag/v3.3.0

Going to submit it to JetBrains later tonight.

Going to resolve this issue, but if you find any bugs etc - feel free to reopen or create a new issue.

@ashald ashald closed this as completed Oct 2, 2022
@mrworkman
Copy link

@mrworkman what did you plan to fix for IDEA? I was under impressions it works fine.

EnvFile didn't work for me in IntelliJ 2022.2.2 until I updated to a more recent SDK and updated the method signature.

@szaffarano
Copy link

@mrworkman it doesn't work in my environment, Build #IU-222.4345.14, built on October 5, 2022
What do you mean by updated the method signature?
Thanks

@it-ony
Copy link

it-ony commented Nov 7, 2022

same here: Intellij Idea Build #IU-222.4345.14, built on October 5, 2022, doesn't load the .env file with plugin version 3.4.1. /cc @ashald

@trondhindenes
Copy link

same here. Is there any version/fork of envfile that is known to work in Pycharm 2022.2.3?

@it-ony
Copy link

it-ony commented Nov 15, 2022

@trondhindenes I guess we need to create a new issue with reference to this one to move people to reopen this isse.

@ashald
Copy link
Owner

ashald commented Nov 22, 2022

Just checked and works like a charm in PyCharm 2022.2.4

@trondhindenes
Copy link

I got it working. The error was that I tried to use envfile with Pycharm's test runner, and that doesn't work. However regular run configurations do. 🤷

@dm-test
Copy link

dm-test commented Nov 22, 2022

IntelliJ IDEA 2022.2.3 (Ultimate Edition)
Build #IU-222.4345.14, built on October 5, 2022
Runtime version: 17.0.4.1+7-b469.62 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0

I have the same problem with Cucumber Java Run/Debug configuration.
But running tests with Maven works good.

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

No branches or pull requests