Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

205
Visualizações
Calling a node js function or script in python

I'm trying to run a node js script from my main.py file in which there are other functions from different files. My main goal is that in one main.py file to run all the functions that I need for my application. I tried to use js2py but it crashed with an error:

raise Ecma51NotSupported('ArrowFunctionExpression')
pyjsparser.std_nodes.Ecma51NotSupported: ArrowFunctionExpression is not supported by ECMA 5.1.

I have also tried to use Naked but that also crashed. I don't need any data from this node js file or anything just to run either all script or one function that it has. In best case scenario it would work just like with .py files: from python_file import do_some_work
do_some_work()

Any suggestions or fix ?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

The error is quite clear, you're using arrow functions ((param) => expression) which are not supported in ECMAScript 5 standard, which is the one used by defualt in js2py.

According to the author, latest versions now support ES6 evaluation by using eval_js6 (source).

So it's either removing the arrow functions and sticking to ES5 or trying this function to run the code.

about 4 years ago · Juan Pablo Isaza Relatório

0

Running whole node js script from main.py using import os and os.system('node file.js') did the job!

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda