473,395 Members | 1,763 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

irritating problem

Hi,

I have a script that runs correctly in IDLE, runs correctly when invoked in the
Command Prompt (Win XP), runs correctly from Komodo, but flashes a black box
too fast to see when the icon is double clicked and produces no output. There
are no error meassages from any of the methods that produce output. All of the
other modules in the same directory (these are imported to the problem module)
work correctly in any start mode.

python 2.3.

Obviously this isn't a disaster, but it "bugs" me. Is there a fix or method of
obtaining diagnostic information on this?

Thanks,

Wendell Cropper
Jul 18 '05 #1
6 2039
Park997 wrote:

I have a script that runs correctly in IDLE, runs correctly when invoked in the
Command Prompt (Win XP), runs correctly from Komodo, but flashes a black box
too fast to see when the icon is double clicked and produces no output. There
are no error meassages from any of the methods that produce output. All of the
other modules in the same directory (these are imported to the problem module)
work correctly in any start mode.


Can you select Properties for that icon and change it so it doesn't close
the window automatically when the program terminates?

Or is this just using the default settings after you've installed Python,
in which case it's being run using the assocation for the .py file extension?
In that case, you should go to Explorer, under View->Folder Options. Then
click the File Types tab, scroll down until you find the entry for the Python
files (make sure you use .py or .pyw as appropriate), then click on Edit,
then on Run in the Actions area, then on Edit. You should then see, in about
the 19th dialog that has popped up (isn't Windows wonderful?! Truly those at
Microsoft are masters of good user interface design!), the actual command
that is being executed when you click on the icon. I suspect it uses the
directory that the .py file is in as the current directory, and it should
show an absolute path to where it thinks Python should be, then something
like "%1" %* which roughly means execute the file using the exact command
plus the filename in quotation marks. I suspect the %* does nothing in most
cases.

If you can then go to the DOS prompt in the same directory, and type the
same command, and everything works.... well then you've got a problem on
your hands, don't you? ;-) (But let us know more, then, as there are
doubtless other steps to take.)

-Peter
Jul 18 '05 #2
Quoting Park997 (pa*****@aol.comnotospam):
Hi,

I have a script that runs correctly in IDLE, runs correctly when
invoked in the Command Prompt (Win XP), runs correctly from Komodo,
but flashes a black box too fast to see when the icon is double
clicked and produces no output. There are no error meassages from
any of the methods that produce output. All of the other modules in
the same directory (these are imported to the problem module) work
correctly in any start mode.


It would be useful to know specifically what output you are expecting
versus what output you are getting.

If it's flashing the box and disappearing, it's conceivable that you
could change the properties such that the cmd window doesn't disappear
after the program completes, right?

Thanks,
--G.

--
Geoff Gerrietts "I think doorways are sexist."
<geoff at gerrietts net> --Jayson Lockwood

Jul 18 '05 #3

"Park997" <pa*****@aol.comnotospam> wrote in message
news:20***************************@mb-m23.aol.com...
Hi,

I have a script that runs correctly in IDLE, runs correctly when invoked in the Command Prompt (Win XP), runs correctly from Komodo, but flashes a black box too fast to see when the icon is double clicked and produces no output. There are no error meassages from any of the methods that produce output. All of the other modules in the same directory (these are imported to the problem module) work correctly in any start mode.

python 2.3.

Obviously this isn't a disaster, but it "bugs" me. Is there a fix or method of obtaining diagnostic information on this?
When you say "all of the other modules ... work correctly in any start
mode,"
do you mean that when you double click on the icon they come up in a dos
box and the box stays around after the module exits? Or does your comment
about importing them mean that you don't attempt to run them independently?

There are *two* command prompts in Windows XP. One is the Command
Prompt you seem to be using (the one with the "c:" icon), the other is the
DOS box.
It's cleverly hidden, but it still exists.

The default action for both of them is to run the command and then exit
immediately; that's why you get the black box that flashes and then
vanishes.
If your script provides a keyboard interface, the console window will stay
around as long as you keep reading keyboard input; it will still go away
immediately when you exit from the console loop and exit the Python script.

There's no obvious way I know of to double click on a Python icon and
have the XP console window stay around after the script exits. This is
because
Python itself invokes the command line processor, and there's no
opportunity to pass it the -k (I think that's the one) parameter.

What I do in the rare cases where I want to directly invoke a Python
script and have the console window stay around is to create one
(or sometimes two) .cmd files. The first .cmd file
invokes a second copy of the XP command line with the -k parameter
(which makes it stay around) and then Python itself.

[cmdfile1.cmd example]

cmd -k python myscript.py parameters...

[end of command script]

This doesn't allow you to set environment variables. If you want to
do that, you need two .cmd files.

[cmdfile1.cmd example]
cmd -k cmdfile2.cmd
[end of cmdfile1.cmd]

[cmdfile2.cmd example]
set envvar=somethingOrOther
python myscript.py theWorldsGreatestParameter
[end of cmdfile2.cmd]

HTH

John Roth


Thanks,

Wendell Cropper

Jul 18 '05 #4
>Can you select Properties for that icon and change it so it doesn't close
the window automatically when the program terminates?

Or is this just using the default settings after you've installed Python,
in which case it's being run using the assocation for the .py file extension?
In that case, you should go to Explorer, under View->Folder Options. Then
click the File Types tab, scroll down until you find the entry for the Python
files (make sure you use .py or .pyw as appropriate), then click on Edit,
then on Run in the Actions area, then on Edit. You should then see, in about

the 19th dialog that has popped up (isn't Windows wonderful?! Truly those at
Microsoft are masters of good user interface design!), the actual command
that is being executed when you click on the icon. I suspect it uses the
directory that the .py file is in as the current directory, and it should
show an absolute path to where it thinks Python should be, then something
like "%1" %* which roughly means execute the file using the exact command
plus the filename in quotation marks. I suspect the %* does nothing in most
cases.

If you can then go to the DOS prompt in the same directory, and type the
same command, and everything works.... well then you've got a problem on
your hands, don't you? ;-) (But let us know more, then, as there are
doubtless other steps to take.)

-Peter



Thanks to everybody for the help. It turns out that there are two separate
python programs associated with the .py extention in windows. I have installed
Python 2.3 over 2.22 and 2.0 without removing any of the previous versions.
This is a numerical program using psyco (only available with the 2.3
installation. When I comment out the psyco import, it runs the double clicked
icon OK.

Thanks again to everybody for the help.

Wendell Cropper
Jul 18 '05 #5
On Mon, 15 Sep 2003 16:32:03 -0400, rumours say that Peter Hansen
<pe***@engcorp.com> might have written:

[snip]
(isn't Windows wonderful?! Truly those at
Microsoft are masters of good user interface design!)

[snip]

Playing the devil's advocate, an old joke about intuitive interfaces
comes to mind (a recent reference:
http://groups.google.com.gr/groups?s...40deadspam.com
:)
--
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.
Jul 18 '05 #6
Christos TZOTZIOY Georgiou wrote:

On Mon, 15 Sep 2003 16:32:03 -0400, rumours say that Peter Hansen
<pe***@engcorp.com> might have written:

[snip]
(isn't Windows wonderful?! Truly those at
Microsoft are masters of good user interface design!)

[snip]

Playing the devil's advocate, an old joke about intuitive interfaces
comes to mind (a recent reference:
http://groups.google.com.gr/groups?s...40deadspam.com
:)


Cute. That must explain the prevalence of so much "nipple-ware" on the web
these days... ;-)

-Peter
Jul 18 '05 #7

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

Similar topics

0
by: sachin bond | last post by:
The following code(in c++) is supposed to divide a file into 'n' different files. suppose i'm having a file called "input.zip". The execution of the following code should divide "input.zip"...
117
by: Peter Olcott | last post by:
www.halting-problem.com
3
by: Deano | last post by:
My form is set up so that if I add a record to my main form, a related record is created in the subform. This occurs in the afterupdate event of my main control. I have made a few changes here,...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
0
by: Gorgen | last post by:
I have a namespace LogRead with one class in it: LogReadWindow I want to program doing a protoype so I write LogRead.ReadLog() on an apropiate place. But it is always changed to...
6
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
4
Ali Rizwan
by: Ali Rizwan | last post by:
Hi I have problem from a couple of years it is the runouce problem how can i solve it it cannot be deleted from taskmanager and not from regestiry can some body help me? Thanx
0
by: Jon Forrest | last post by:
This isn't actually a C# issue, but probably many people who use C# have experienced the issue mentioned in http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=311797...
13
by: akshaycjoshi | last post by:
I am developing one web app in which i need to connect to 6 access databases one at a time. The problem is that the code does not work well properly, sometimes it gets stuck over Executereader()...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.