Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Flake8 error after install: error importing function defintion for switchml #643

Closed
clcollins opened this issue Oct 8, 2018 · 1 comment · Fixed by atom/atom#20393
Closed

Comments

@clcollins
Copy link

clcollins commented Oct 8, 2018

After install, I received Error running Flake8 when opening a python file in Atom:

[Linter] Error running Flake8 Error: /bin/sh: module: line 1: syntax error: unexpected end of file
/bin/sh: error importing function definition for `module'
/bin/sh: scl: line 1: syntax error: unexpected end of file
/bin/sh: error importing function definition for `scl'
/bin/sh: switchml: line 1: syntax error: unexpected end of file
/bin/sh: error importing function definition for `switchml'
    at ChildProcess.<anonymous> (/home/chris/.atom/packages/linter-flake8/node_modules/sb-exec/lib/index.js:56:20)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Socket.stream.socket.on (internal/child_process.js:346:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:554:12)

Running flake8 directly on the file works fine. I tried removing linter and all the linter packages and language packages, and reinstalling just linter and linter-flake8, but continue to receive the error message. Any assistance would be apprciated.

Thanks!

System info

Linter flake8 version
linter-flake8 v2.3.0

Atom Version

$ atom --version
Atom    : 1.31.1
Electron: 2.0.7
Chrome  : 61.0.3163.100
Node    : 8.9.3

Flake8 version

$ flake8 --version
3.4.1 (flake8-docstrings: 1.3.0, pydocstyle: 2.1.1, mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 3.6.6 on Linux

Python3 version

$ python3 --version
Python 3.6.6

OS version

$ cat /etc/redhat-release 
Fedora release 28 (Twenty Eight)
@clcollins
Copy link
Author

After more searching, I found this: atom/atom#13451

This solved the problem for me, so closing this issue: not a linter-flake8 problem.

Hopefully Atom or the Fedora package maintainers will fix the issue.

xdelaruelle added a commit to xdelaruelle/atom that referenced this issue Feb 8, 2020
`getEnvFromShell` function calls `env` command through shell to get all
defined environment variable. However `env` also returns the shell
function defined with their whole code written on multiple lines.

Such shell function definitions were not properly handled by
`getEnvFromShell` which led to the following kind of error messages
(seen for instance when running a terminal package in Atom):

  bash: module: line 1: syntax error: unexpected end of file
  bash: error importing function definition for `BASH_FUNC_module'

With this change `getEnvFromShell` now skips shell function definition
to guarantee only environment variables are recorded and a sane `result`
array is returned.

Fixes atom#20389
Fixes atom#17369
Fixes atom#13451
Fixes blueimp/atom-open-terminal-here#27
Fixes blueimp/atom-open-terminal-here#18
Fixes bus-stop/Termination#101
Fixes bus-stop/terminus#24
Fixes platformio/platformio-atom-ide-terminal#120
Fixes platformio/platformio-atom-ide-terminal#293
Fixes AtomLinter/linter-pylint#243
Fixes AtomLinter/linter-flake8#643
Fixes AtomLinter/linter-flake8#165
Fixes AtomLinter/linter-flake8#422
Fixes AtomLinter/linter-puppet-lint#68
Fixes autocomplete-python/autocomplete-python#347
xdelaruelle added a commit to xdelaruelle/atom that referenced this issue Feb 8, 2020
`getEnvFromShell` function calls `env` command through shell to get all
defined environment variable. However `env` also returns the shell
function defined with their whole code written on multiple lines.

Such shell function definitions were not properly handled by
`getEnvFromShell` which led to the following kind of error messages
(seen for instance when running a terminal package in Atom):

  bash: module: line 1: syntax error: unexpected end of file
  bash: error importing function definition for `BASH_FUNC_module'

With this change `getEnvFromShell` now skips shell function definition
to guarantee only environment variables are recorded and a sane `result`
array is returned.

Fixes atom#20389
Fixes atom#17369
Fixes atom#13451
Fixes blueimp/atom-open-terminal-here#27
Fixes blueimp/atom-open-terminal-here#18
Fixes bus-stop/Termination#101
Fixes bus-stop/terminus#24
Fixes platformio/platformio-atom-ide-terminal#120
Fixes platformio/platformio-atom-ide-terminal#293
Fixes AtomLinter/linter-pylint#243
Fixes AtomLinter/linter-flake8#643
Fixes AtomLinter/linter-flake8#165
Fixes AtomLinter/linter-flake8#422
Fixes AtomLinter/linter-puppet-lint#68
Fixes autocomplete-python/autocomplete-python#347
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants