Galooshi / sublime-import-js

Sublime Text plugin for ImportJS
MIT License
24 stars 2 forks source link

Python error: Can't convert 'NoneType' object to str implicitly #10

Open alebiavati opened 8 years ago

alebiavati commented 8 years ago

Hi! Thank you for writing this plugin, looks like it could really speed up development! I'm trying the plugin for the first time and I'm getting this error:

['/Users/alebiavati/.nvm/versions/node/v5.9.0/bin/importjs', None, '/Users/alebiavati/code/test-project/src/test.js']
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 568, in run_
    return self.run(edit, **args)
  File "import-js in /Users/alebiavati/Library/Application Support/Sublime Text 3/Installed Packages/ImportJS.sublime-package", line 114, in run
  File "./python3.3/subprocess.py", line 819, in __init__
  File "./python3.3/subprocess.py", line 1386, in _execute_child
TypeError: Can't convert 'NoneType' object to str implicitly

My configuration is this:

/Users/alebiavati/code/test-project/.importjs.json

{
  "lookupPaths": ["src"],
  "useRelativePaths": true,
  "importDevDependencies": true,
  "aliases": {
    "$": "third-party-libs/jquery",
    "styles": "./{filename}.scss"
  }
}

and my test file is this:

/Users/alebiavati/code/test-project/src/test.js

import MainNav from './components/MainNav';

const test = MainNav;

/Users/alebiavati/code/test-project/src/components/MainNav.js

import { Component } from 'react';

export default class MainNav extends Component { }

If I run importjs from the command line I get the proper result:

$ importjs goto MainNav src/test.js
{"messages":[],"fileContent":"import MainNav from './components/MainNav';\n\nconst test = MainNav;\n","unresolvedImports":{},"goto":"src/components/MainNav.js"}

but when using the sublime plugin I get the error above. This happens if I try to use any of the importjs commands: goto module, import word under cursor, or fix all imports.

Have you ever seen something like this?

Thanks in advance for the help! and again, great plugin!!