GithubHelp home page GithubHelp logo

paradoxxxzero / atom-python-import-magic Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 2.0 39 KB

Import automatically python modules using importmagic

License: MIT License

Python 32.70% JavaScript 66.36% Less 0.94%

atom-python-import-magic's People

Contributors

paradoxxxzero avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

atom-python-import-magic's Issues

Uncaught TypeError: Cannot read property 'getBuffer' of undefined

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.11.2
Electron Version: 0.37.8
System: Ubuntu 16.04.1
Thrown From: python-import-magic package, v0.7.0

Stack Trace

Uncaught TypeError: Cannot read property 'getBuffer' of undefined

At /home/solani/.atom/packages/python-import-magic/lib/python-import-magic.coffee:55

TypeError: Cannot read property 'getBuffer' of undefined
    at Object.module.exports.update (/home/solani/.atom/packages/python-import-magic/lib/python-import-magic.coffee:55:21)
    at atom-workspace.subscriptions.add.atom.commands.add.python-import-magic:update (/home/solani/.atom/packages/python-import-magic/lib/python-import-magic.coffee:29:41)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app.asar/src/command-registry.js:260:29)
    at /usr/share/atom/resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/usr/share/atom/resources/app.asar/src/window-event-handler.js:114:36)
    at HTMLDocument.<anonymous> (/usr/share/atom/resources/app.asar/src/window-event-handler.js:3:61)

Commands

     -0:00.1.0 python-import-magic:update (div.panels-item)

Config

{
  "core": {
    "openEmptyEditorOnStart": false,
    "telemetryConsent": "limited",
    "themes": [
      "one-dark-ui",
      "atom-dark-syntax"
    ]
  }
}

Installed Packages

# User
atom-python-package, v0.7.0 (inactive)
autocomplete-python, v1.8.7 (active)
linter, v1.11.18 (active)
linter-python, v3.0.5 (active)
linter-python-pep8, v0.2.0 (active)
python-autopep8, v0.1.3 (active)
python-debugger, v0.1.0 (inactive)
python-import-magic, v0.7.0 (active)
python-indent, v1.0.0 (active)
python-nosetests, v0.2.0 (inactive)
python-snippets, v1.9.0 (active)
python-tools, v0.6.8 (active)
atom-dark-syntax, v0.27.0 (active)
atom-dark-ui, v0.52.0 (inactive)
atom-light-syntax, v0.28.0 (inactive)
atom-light-ui, v0.44.0 (inactive)
base16-tomorrow-dark-theme, v1.2.0 (inactive)
base16-tomorrow-light-theme, v1.2.0 (inactive)
one-dark-ui, v1.6.0 (active)
one-light-ui, v1.6.0 (inactive)
one-dark-syntax, v1.3.0 (inactive)
one-light-syntax, v1.3.0 (inactive)
solarized-dark-syntax, v1.0.2 (inactive)
solarized-light-syntax, v1.0.2 (inactive)
about, v1.7.0 (active)
archive-view, v0.61.1 (active)
autocomplete-atom-api, v0.10.0 (active)
autocomplete-css, v0.11.2 (active)
autocomplete-html, v0.7.2 (active)
autocomplete-plus, v2.31.1 (active)
autocomplete-snippets, v1.11.0 (active)
autoflow, v0.27.0 (inactive)
autosave, v0.23.1 (active)
background-tips, v0.26.1 (active)
bookmarks, v0.42.0 (active)
bracket-matcher, v0.82.1 (active)
command-palette, v0.38.0 (inactive)
deprecation-cop, v0.54.1 (active)
dev-live-reload, v0.47.0 (active)
encoding-selector, v0.22.0 (active)
exception-reporting, v0.40.0 (active)
find-and-replace, v0.201.1 (inactive)
fuzzy-finder, v1.4.0 (active)
git-diff, v1.1.0 (active)
go-to-line, v0.31.0 (inactive)
grammar-selector, v0.48.2 (active)
image-view, v0.59.0 (active)
incompatible-packages, v0.26.1 (active)
keybinding-resolver, v0.35.0 (active)
line-ending-selector, v0.5.0 (active)
link, v0.31.1 (inactive)
markdown-preview, v0.158.0 (active)
metrics, v1.0.0 (active)
notifications, v0.65.1 (active)
open-on-github, v1.2.0 (inactive)
package-generator, v1.0.0 (inactive)
settings-view, v0.242.2-hotfix1 (active)
snippets, v1.0.2 (active)
spell-check, v0.68.2 (active)
status-bar, v1.4.1 (active)
styleguide, v0.47.0 (active)
symbols-view, v0.113.1 (inactive)
tabs, v0.101.0 (active)
timecop, v0.33.2 (active)
tree-view, v0.209.3 (active)
update-package-dependencies, v0.10.0 (active)
welcome, v0.35.1 (active)
whitespace, v0.33.0 (active)
wrap-guide, v0.38.2 (active)
language-c, v0.52.1 (active)
language-clojure, v0.21.0 (active)
language-coffee-script, v0.47.2 (active)
language-csharp, v0.12.1 (active)
language-css, v0.37.1 (active)
language-gfm, v0.88.0 (active)
language-git, v0.15.0 (active)
language-go, v0.42.1 (active)
language-html, v0.45.1 (active)
language-hyperlink, v0.16.0 (active)
language-java, v0.23.0 (active)
language-javascript, v0.119.0 (active)
language-json, v0.18.2 (active)
language-less, v0.29.5 (active)
language-make, v0.22.2 (active)
language-mustache, v0.13.0 (active)
language-objective-c, v0.15.1 (active)
language-perl, v0.35.0 (active)
language-php, v0.37.2 (active)
language-property-list, v0.8.0 (active)
language-python, v0.45.0 (active)
language-ruby, v0.69.0 (active)
language-ruby-on-rails, v0.25.0 (active)
language-sass, v0.56.0 (active)
language-shellscript, v0.22.4 (active)
language-source, v0.9.0 (active)
language-sql, v0.23.0 (active)
language-text, v0.7.1 (active)
language-todo, v0.28.0 (active)
language-toml, v0.18.0 (active)
language-xml, v0.34.9 (active)
language-yaml, v0.26.0 (active)

# Dev
No dev packages

Python 2.7

Hello,

Thanks a lot for the package =)

I can't use it on Python 2.7 though because of

Python Import Magic Invocation Error
Traceback (most recent call last):
  File "/Users/horta/.atom/packages/python-import-magic/lib/import_magic_interface.py", line 5, in <module>
    from itertools import accumulate, chain
ImportError: cannot import name accumulate

Are you planning to support Python 2.7?

Uncaught Error: spawn EACCES

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.16.0 x64
Electron: 1.3.13
OS: Ubuntu 16.04.2
Thrown From: python-import-magic package 1.0.3

Stack Trace

Uncaught Error: spawn EACCES

At internal/child_process.js:313

Error: spawn EACCES
    at exports._errnoException (util.js:1026:11)
    at ChildProcess.spawn (internal/child_process.js:313:11)
    at exports.spawn (child_process.js:392:9)
    at call (/packages/python-import-magic/lib/proc.js:43:18)
    at Object.reindex (/packages/python-import-magic/lib/python-import-magic.js:80:5)
    at /packages/python-import-magic/lib/python-import-magic.js:37:49)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/app.asar/src/command-registry.js:259:29)
    at /app.asar/src/command-registry.js:3:59
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:599:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:390:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/app.asar/src/window-event-handler.js:106:36)
    at /app.asar/src/window-event-handler.js:3:59)

Commands

     -0:53.7.0 settings-view:open (input.hidden-input)
     -0:29 python-import-magic:update (input.hidden-input)
     -0:10.9.0 pane:show-next-item (input.hidden-input)
     -0:06.2.0 pane:show-previous-item (div.package-detail.panels-item)
     -0:03.7.0 python-import-magic:reindex (input.hidden-input)

Non-Core Packages

autocomplete-python 1.8.61 
python-autopep8 0.1.3 
python-import-magic 1.0.3 
python-tools 0.6.9 
seti-icons 1.4.3 

plugin shouldn't be running pip

I understand what you're going for with having the plugin automatically install its own dependencies here - but this is really unexpected behavior for a plugin and can create issues for people.

In my situation, I have systemwide pip blocked to prevent me from accidentally using it without a virtualenv. This code tries to run when Atom starts up and before it has opened the project and picked the right python binary. This means I get an error in read_index (which is called from __init__ ) because importmagic is still None.

Once the project is loaded up, the plugin gets invoked with the proper interpreter but there's still that error on startup. Going back to the root issue, I wouldn't want an Atom plugin automatically doing anything with pip for me.

import magic doesn't work

The package doesn't work for me in spite of all the dependencies in place. Could someone please help? Thanks in advance!

image

Uncaught TypeError: Cannot read property 'split' of undefined

When the python package is not installed, I got this error when I try to magic import :

Stack Trace

Uncaught TypeError: Cannot read property 'split' of undefined

At /usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:823

TypeError: Cannot read property 'split' of undefined
    at Object.lineDiff.tokenize (/usr/lib/atom/node_modules/text-buffer/node_modules/diff/lib/diff/line.js:22:31)
    at Object.diff (/usr/lib/atom/node_modules/text-buffer/node_modules/diff/lib/diff/base.js:36:39)
    at Object.diffLines (/usr/lib/atom/node_modules/text-buffer/node_modules/diff/lib/diff/line.js:47:19)
    at /usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:506:27
    at TextBuffer.module.exports.TextBuffer.transact (/usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:818:18)
    at TextBuffer.module.exports.TextBuffer.setTextViaDiff (/usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:500:19)
    at /packages/python-import-magic/lib/python-import-magic.js:76:42
    at /packages/python-import-magic/lib/proc.js:76:21)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:493:12)

Maybe a more explicit error such as ' You need to ****ing install the python package you dumass ' could be nice ๐Ÿ‘

Uncaught SyntaxError: Unexpected token P in JSON at position 0

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.15.0 x64
Electron: 1.3.13
OS: Mac OS X 10.12.3
Thrown From: python-import-magic package 0.11.0

Stack Trace

Uncaught SyntaxError: Unexpected token P in JSON at position 0

At file:///Applications/Atom.app/Contents/Resources/app.asar/static/index.html:1

SyntaxError: Unexpected token P in JSON at position 0
    at Object.parse (native)
    at /packages/python-import-magic/lib/proc.coffee:47:18)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:493:12)

Commands

Non-Core Packages

atom-python-run 0.7.3 
autocomplete-python 1.8.62 
build 0.67.0 
build-python 0.9.1 
busy 0.7.0 
Hydrogen 1.7.0 
ipython-exec 1.2.0 
jupyter-notebook 0.0.9 
kite 0.18.0 
language-kivy 0.1.1 
minimap 4.26.8 
minimap-bookmarks 0.4.2 
minimap-codeglance 0.4.5 
minimap-cursorline 0.2.0 
minimap-find-and-replace 4.5.2 
minimap-highlight-selected 4.5.0 
minimap-pigments 0.2.2 
minimap-selection 4.4.0 
python-import-magic 0.11.0 
python-iresolve 0.0.3 
python-isort 0.0.7 
python-snippets 1.9.0 
python-tools 0.6.9 
python-yapf 0.13.0 
tool-bar-almighty 0.8.1 
wakatime 6.0.13 

Error when re-indexing by saving and by shortcut.

Hey, I've encountered this error (see bottom) consistently when reindexing.

I guess it creates the .tmp file first but then forgets to remove the original when trying to rename the .tmp file.

I fixed the issue by making it delete the old index file before renaming the tmp file:

https://github.com/paradoxxxzero/atom-python-import-magic/blob/master/lib/import_magic_interface.py#L110

I changed:

        if os.path.exists(self._tmp_index_file):
            os.rename(self._tmp_index_file, self.index_file)

to

        if os.path.exists(self._tmp_index_file):
            if os.path.isfile(self.index_file):
                os.unlink(self.index_file)
            os.rename(self._tmp_index_file, self.index_file)

If this solution is appropriate I can submit a PR for it, just say so then.

Error:

Python Import Magic Invocation Error
Traceback (most recent call last):
  File "C:\Users\mainpcuser\.atom\packages\python-import-magic\lib/import_magic_interface.py", line 167, in <module>
    Commands().run()
  File "C:\Users\mainpcuser\.atom\packages\python-import-magic\lib/import_magic_interface.py", line 98, in run
    fun(**self.data)
  File "C:\Users\mainpcuser\.atom\packages\python-import-magic\lib/import_magic_interface.py", line 121, in reindex
    self.create_index()
  File "C:\Users\mainpcuser\.atom\packages\python-import-magic\lib/import_magic_interface.py", line 111, in create_index
    os.rename(self._tmp_index_file, self.index_file)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'K:\\some_folder\\.magicindex.json.tmp' -> 'K:\\some_folder\\.magicindex.json'

Error: spawn python ENOENT

The error happens right after installation or when I enable the package.
Ubuntu 20.04.2 LTS
Python 3.8.5
isort 5.8.0
importmagic 0.1.7
Screenshot from 2021-04-10 21-33-01

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.