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

Error importing python-shell on windows 10 #164

Closed
Gatunox opened this issue Nov 27, 2018 · 5 comments
Closed

Error importing python-shell on windows 10 #164

Gatunox opened this issue Nov 27, 2018 · 5 comments

Comments

@Gatunox
Copy link

Gatunox commented Nov 27, 2018

On my windows 10, with node --version v11.2.0 when i execute import {PythonShell} from 'python-shell'; I get:

import {PythonShell} from 'python-shell';
       ^

SyntaxError: Unexpected token {

What's wrong?

Using let {PythonShell} = require('python-shell') Does work.

@Almenon
Copy link
Collaborator

Almenon commented Nov 27, 2018

Did you read this part of the readme?

Note the use of imports! If you're not using typescript ಠ_ಠ you can still get imports to work with this guide.

@Gatunox
Copy link
Author

Gatunox commented Nov 27, 2018

Ok, I'm not planning to install nor use TypeScript so I will disregard and close this.

@Gatunox Gatunox closed this as completed Nov 27, 2018
@Almenon
Copy link
Collaborator

Almenon commented Nov 27, 2018

You don't have to use typescript, see the link I provided above:

So if you want to use imports you have four options:

  1. Use latest version of node with --experimental-modules flag. Node 8.5 might also work.
  2. use babel
  3. use esm
  4. use typescript (not applicable in your case)

@Gatunox
Copy link
Author

Gatunox commented Nov 27, 2018

Yes, understood, I only mentioned it because that wat the option recomended on that link, But since I know trat required works like I mentioned before I'm ok with that, I will keep using require.

@Almenon
Copy link
Collaborator

Almenon commented Nov 27, 2018

Ah, okay then.

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

2 participants