Python Questions - July 25, 2015

E.D.G. edgrsprj at ix.netcom.com
Sat Jul 25 11:39:43 CEST 2015


Posted by E.D.G. July 25, 2015

       This posting involves general interest matters and some specific 
questions regarding Python code usage.  Any help would be appreciated.

1. Program conversion effort
2. Specific code questions


1.  PROGRAM CONVERSION EFFORT

       An effort is underway by several people including myself to convert a 
complex Perl language program to some other language such as Python so that, 
among other things, the program's numerous calculations will run faster.

       Perl with the PDL module would probably work.  But we could not get 
the needed type of support for the PDL module.  We also looked at Julia and 
several versions of Basic.  But they also did not appear to presently have 
the type of support that is needed.

       Fortran was tried.  It is great for calculation speed and the Fortran 
users were quite helpful.  But we could not get certain important questions 
answered regarding using Fortran to create Windows "Pipes" to other running 
programs etc.

       We are presently checking to see if Python has the needed features 
and adequate support from Python newsgroups or forums.

       At the moment our Perl programs use Windows "Pipes" plus files in an 
interactive mode to send data to Gnuplot so that the data can be plotted. 
That actually produces good results.  But it is a complex and inefficient 
process.  So part of the conversion process involves learning how to have 
Python or some other program plot data in the same interactive mode.

       In this case "interactive" means that when a chart is being displayed 
on the computer screen for example, a key such as a Right Arrow Key can be 
pressed.  My main Perl program checks for key presses perhaps 10 times a 
second and if it detects one it sends the appropriate information to Gnuplot 
through a "Pipe" so that Gnuplot will open some data file and use its 
contents to draw a new chart.  That redrawing process on a moderately fast 
computer occurs so rapidly the transition cannot even be seen.

       The Perl program does not simply wait for a key to be pressed because 
it is at times processing data in the background.

       It has been my experience that sending large amounts of data from one 
program to another using a Windows pipe doesn't work very well.  So files 
are presently being used for bulk data transfers.


2.  SPECIFIC CODE QUESTIONS

       It will likely take some time to get all of these questions 
completely answered, especially the ones involving graphics.


1. The initial version of Python being used has to be a free download that 
is easy to understand.  And it has to be compatible with Windows.

       Where can the best free download version of Python be obtained?

       Is the ActiveState version the best one for people who are not Python 
experts?

       I always found it quite easy to install ActiveState versions of Perl.


2.  Graphics - This is likely a fairly complicated question.

       What are some of the graphics options available with Python?

       Does it have its own internal graphics routines?  Perl does not as 
far as I can tell.  And we never had time to explore Fortran's graphics 
capabilities.

       I am aware of the existence of Matlab.  But as stated, everything 
involved with this present effort has to be a free download so that 
programmers around the world can easily and inexpensively generate program 
subroutines etc.


3.  Fast Calculations

       It is my expectation that Python by itself does not do calculations 
very fast when compared to a language such as Fortran.

       So, what options are available for increasing the speed of Python 
calculations?

       Python could call a Fortran program to do the calculations just as 
Perl could.  But we would like to avoid having to use more than one language 
with this effort.


4. What is the code for opening a Windows "Pipe" between a running Python 
program and some other program such as another Python or Perl program that 
can work with pipes?

       Three examples are needed if possible, one for just sending, one for 
just receiving, and one that allows both sending and receiving.  I know how 
to open Windows pipes using Perl.


5. We would want Python to check for a key press now and then without 
actually waiting until a key is pressed.  What would be the command for 
that?  It is likely something like Get_Key


6. What is Python's version of the DOS level "System" command that many 
programs use as in:

system "open notepad.exe"


7. What is Python's version of the SendKey command that many programs use to 
send information to an active Windows program as in:

SendKey("Message to be printed on the Notepad screen")

or

SendKey(Right Arrow Key)


8. What commands does Python use to send to, and retrieve information from, 
the Windows clipboard?


       Regards, and thanks again for any assistance with this.

E.D.G.



More information about the Python-list mailing list