LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 09-30-2013, 12:32 PM   #1
Dafydd
Member
 
Registered: Oct 2008
Posts: 315

Rep: Reputation: 23
Running a 'python' program on 'Windows"


Is a program written in 'python' cross platform compatible?
If I type from a terminal:
Code:
python plot-houston.py
to run it on my Linux system, how do I run it on a Windows or Apple computer?
 
Old 09-30-2013, 01:07 PM   #2
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 3,216

Rep: Reputation: 820Reputation: 820Reputation: 820Reputation: 820Reputation: 820Reputation: 820Reputation: 820
In theory... Of course, you do have to get Python installed first! Have a look at this
http://docs.python.org/2/faq/windows.html
 
1 members found this post helpful.
Old 09-30-2013, 01:10 PM   #3
sag47
Senior Member
 
Registered: Sep 2009
Location: Philly, PA
Distribution: Kubuntu x64, RHEL, Fedora Core, FreeBSD, Windows x64
Posts: 1,505
Blog Entries: 35

Rep: Reputation: 383Reputation: 383Reputation: 383Reputation: 383
That's a "depends" type question. It depends on the dependencies of the python program and how it is installed on windows/mac. If all of the modules are available and installed on all three platforms and the python code isn't using any platform specific code (e.g. search the proc filesystem for stats and info which is only available on Linux) then it is highly possible the script can be run on multiple platforms with little or no modification.

As for how you run that script on the other platforms it depends on how the user installed python. In Windows if there's %PATH% and explorer integration then one could simply double click on the *.py script to run it (though it may disappear right away depending on what it is doing if it doesn't pause to show output). If there's %PATH% integration then one could also open the command prompt and run the script the same way you do on Linux.

With Mac it also depends on the package and how it integrates with the system though most recommended methods for Mac have $PATH integration. It is BSD based and uses bash for the terminal shell so just run it like you would any other.

For a more specific answer you'll need to provide more information or code samples with your question and describe the client environment.

Last edited by sag47; 09-30-2013 at 06:03 PM.
 
1 members found this post helpful.
Old 09-30-2013, 06:30 PM   #4
Dafydd
Member
 
Registered: Oct 2008
Posts: 315

Original Poster
Rep: Reputation: 23
Thank you for the replies. You have given me more information than I knew that I was supposed to ask........

I guess my fishing club will have to do without this membership information.
 
Old 09-30-2013, 09:22 PM   #5
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,455

Rep: Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172
The short-answer is that languages such as Python, Perl, PHP, Ruby and so-on are generally designed to be, at least, "operating-system agnostic." The core-language will run anywhere on anything. However, the reality is that the operating systems are different-enough to cause problems in the various edge-cases. Therefore, if you are deploying an application that is intended to be "cross-platform," a certain amount of care must be taken. Perhaps your requirements are "nowhere near 'the edge.'" On the other hand, maybe they are.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Python/Bash script to check conditions for running "poweroff" command gnuub Programming 3 12-04-2012 04:31 AM
[SOLVED] I get "'found module version 0, expected 9" Error while running a fortran 90 program. msbstar Linux - Newbie 4 09-16-2012 03:44 PM
Python "support" included in C program ITPhoenix Programming 2 07-11-2011 08:17 PM
Python program not running from cron spiri Linux - Software 7 03-09-2006 03:02 AM
User "list" running process "python" TroelsSmit Linux - Newbie 2 02-22-2005 05:55 AM


All times are GMT -5. The time now is 11:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration