472,784 Members | 818 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,784 software developers and data experts.

Executing python script in non-interactive mode on cygwin (windows)

I am facing a very basic problem as any new bie would face.

I know perl and now i want to use python

In perl, it is very simple , just
"perl scriptname.pl"
will execute the script.

But i think python is worse than perl

It takes to interactive mode , which i don;t want to use.

"python scriptname.py"
does not execute python script

It was, i don't know executing it or not.

1. I placed these contents in a file named "1.py"
a,b=0,1
n=5
while n<=0:
print b
a=b
b=a+b
n=n-1
print n

Then

2.
on "cygwin shell in windows"
i gave "python 1.py"

hoping that it will exeucte and give me output, but nothing was
printed

Does python not support teh non-interactive mode of execution

I have the manuals and they dont' specify this thing anywhere. they
tell use "python -c filename"
Please help.
A newbie's request.

Pankaj
i gav

Jan 23 '06 #1
3 2352
"Pankaj" wrote:
I know perl and now i want to use python

In perl, it is very simple , just
"perl scriptname.pl"
will execute the script.

But i think python is worse than perl

It takes to interactive mode , which i don;t want to use.

"python scriptname.py"
does not execute python script

It was, i don't know executing it or not.

1. I placed these contents in a file named "1.py"
a,b=0,1
n=5
while n<=0:
print b
a=b
b=a+b
n=n-1
print n

Then

2.
on "cygwin shell in windows"
i gave "python 1.py"

hoping that it will exeucte and give me output, but nothing was
printed

Does python not support teh non-interactive mode of execution n=5
while n<=0:


not sure about Perl, but in Python, five is not less than or equal
to zero.

maybe you meant to write:

n=5
while n >= 0:

?

</F>

Jan 23 '06 #2
Thanks

it was my mistake

Jan 23 '06 #3
Pankaj enlightened us with:
But i think python is worse than perl
No it isn't.
It takes to interactive mode , which i don;t want to use.
Then don't use it.
"python scriptname.py"
does not execute python script
Yes it does.
1. I placed these contents in a file named "1.py"
a,b=0,1
n=5
while n<=0:
Which is immediately false.
on "cygwin shell in windows"
i gave "python 1.py"

hoping that it will exeucte and give me output, but nothing was
printed


Which is correct for your program.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Jan 23 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Andrew Chalk | last post by:
Is this possible? In my CGI app. I display a web page with a link (anchor). When the link is clicked I want to exectute a python script rather than go to an HTML page. Many thanks.
0
by: SS | last post by:
I am trying to execute some python commands within a perl script and running into problems. The following works: python -c "import mypkg;do this; do that" however when I try to do something like...
52
by: Olivier Scalbert | last post by:
Hello , What is the python way of doing this : perl -pi -e 's/string1/string2/' file ? Thanks Olivier
1
by: sarmin kho | last post by:
Hi Python Guru, I ve created a GUI using Boa constructor and am now trying to execute a python script when pressing a button on the GUI. So, there will then be two main threads running (the GUI...
8
by: Darren Dale | last post by:
Is there a place to put python programs so I dont have to refer to the absolute path everytime I want to call them? For example: if I am in /home/me and want to execute: python...
1
by: Valentina Boycheva | last post by:
Thanks for the reply. I already have "Learning Python" from Mark Lutz and David Ascher, which covers 2.3 (I am in 2.4). However, it seems like heavy artillery to me. What I want is, for instance,...
0
by: Ian Warford | last post by:
Hi, I have a problem with a PL/PerlU function trying to execute an external perl script. The script is suid to a non-root user and I am executing it in the PL/PerlU function as so : $rc =...
3
by: olaufr | last post by:
Hi, I need to call a python script, with command line arguments (it is an autonomous script with a __main__), from within another python script. Can I use exec() or execfile() for this? How to...
4
by: Andrew Ayre | last post by:
Hi, I have a script that I want to execute from C. I don't want to call any functions, just execute the script. Below is a code snippet. The problem is that PyObject_CallObject always returns...
2
by: gaurav kashyap | last post by:
HI all, i have two python programs as 1.py and 2.py 1.py import os import sys processID=os.spawnl(os.P_WAIT,'/usr/local/bin/python','python','/ mywork/2.py ' + 'hi') 2.py
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.