Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Embedding Python in C++

Embedding Python in C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++pythoncomhardwaretutorial
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Good Morning Sir, I referred this tutorial, Embedding Python program in a C/C++ code[^] I have followed up the tutorial and successfully embedded Python in my code.

    PyRun_SimpleString("print('Hello World from Embedded Python!!!')");

    is used to execute a single line of Python code but how do I run a multiple lines of code in Python. I also tried running a Python from a file but the file also needed to be there for running the executable. :(( I dont want a file along with my executable, I searched in the google sir but I find no results. I am confused here, I dont know what to do:confused: Thank you sir for your time

    A 1 Reply Last reply
    0
    • L Lost User

      Good Morning Sir, I referred this tutorial, Embedding Python program in a C/C++ code[^] I have followed up the tutorial and successfully embedded Python in my code.

      PyRun_SimpleString("print('Hello World from Embedded Python!!!')");

      is used to execute a single line of Python code but how do I run a multiple lines of code in Python. I also tried running a Python from a file but the file also needed to be there for running the executable. :(( I dont want a file along with my executable, I searched in the google sir but I find no results. I am confused here, I dont know what to do:confused: Thank you sir for your time

      A Offline
      A Offline
      Afzaal Ahmad Zeeshan
      wrote on last edited by
      #2

      Ask this question right under that post and author will tell you how. There is a forum provided for questions about methodology of the article, or similar aspects etc. That is, so that if someone else happens to have a similar problem, they can know how to solve this.

      The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

      L 1 Reply Last reply
      0
      • A Afzaal Ahmad Zeeshan

        Ask this question right under that post and author will tell you how. There is a forum provided for questions about methodology of the article, or similar aspects etc. That is, so that if someone else happens to have a similar problem, they can know how to solve this.

        The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Thank you sir I have posted the question below the article :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups