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

467
Visualizações
Replacing PyString_FromString method in python 3

TLDR; PyString_FromString doesn't work in Python3.5 so I need an alternative.

I am following an example for including python 3 within a C++ project from this python documentation: https://docs.python.org/3/extending/embedding.html

Everything is working fine but now I want to change the line that reads:

pValue = PyLong_FromLong(atoi(argv[i + 3]));

to the following (I also no longer use i, that was from a loop):

pValue = PyString_FromString("A string instead of a number");

It seems the PyString_FromString function is no longer an option Python3.5 and I get the following error when I compile the code with g++:

main.cpp:559:60: error: ‘PyString_FromString’ was not declared in this scope
         pValue = PyString_FromString("A string instead of a number");`

Any idea on how I get around this? No matter what I look for I can't seem to find a solution that doesn't throw an error. I need to pass a string to my Python file and I have a string to start with already.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

PyUnicode_FromString()

if (!(pValue = PyUnicode_FromString("A string instead of a number")))
  return NULL;
over 4 years ago · Santiago Trujillo 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