Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Chris 33 · Mar 10, 2011 at 04:42 AM · javascriptruncalllaunchpython

Launch a python script from a javascript file

Hello, i just need a simple way to launch a python interpreter (which will run some simple I/O functions in the background) at the start of my game. Cannot find this anywhere on the internets.

I'm using it grab some sensor values to pass to unity, but its not really a smooth operation to have to manually start the interpreter from a terminal window.

Thanks!

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image yoyo · Mar 10, 2011 at 05:29 AM 0
Share

What are your "sensor values"? Are you running Unity with some interesting custom hardware? (just curious ...)

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by yoyo · Mar 10, 2011 at 05:28 AM

You can launch an external process like this (Javascript or C#) ...

System.Diagnostics.Process.Start("python.exe", "boaconstrictor.py");

For more information (there are lots of options), see the MSDN docs. You can redirect and capture standard output and standard error, pass in more options, wait for the process to complete, etc.

Note that if this is for other people to use you will need to ensure python is available on their system -- this will work best in the Unity editor environment, or should be ok from a standalone build but I would be very surprised if it worked from a web player (and an iPhone is right out! ;-)

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Chris 33 · Mar 10, 2011 at 05:54 AM 0
Share

sorry, forgot to mention im working on OSX. I couldn't get this to work, i did remove the .exe extension. Also, im not very sure where to check whether the process has actually started. Im new to this aspect of program$$anonymous$$g.

  • im trying to pass some simple values from soft switches sewn into an outfit, that will control an avatar in-game, plus a photocell to regulate environmental light.

Thanks!

avatar image yoyo · Mar 10, 2011 at 06:47 AM 0
Share

It ought to work cross-platform, but I'm on Windows, so no guarantees. Try getting it to launch something simple you know should work -- I tested by launching notepad.exe, the little text editor that comes with Windows.

avatar image yoyo · Mar 10, 2011 at 06:47 AM 0
Share

Sensor rig sounds like fun, good luck!

avatar image yoyo · Mar 10, 2011 at 06:49 AM 0
Share

P.S. Once you know you can launch an external process, look at the $$anonymous$$SDN docs to see how to capture standard output, then you can send it to Unity's Debug.Log to see what's happening.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Launch a Python Interpreter from Unity [Javascript] 0 Answers

How can I Javascript a phone call from within Unity? 1 Answer

Programming language C# learning resource 2 Answers

Call SoundManager with JS? 0 Answers

Calling Functions from another Script 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges