473,385 Members | 1,798 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,385 software developers and data experts.

How does python call OS?

I just finished reading a chapter in "Python Programming on Win32" and tried
out the pythonwin scribble application. I'm not sure if I got it right
because I could not open a new document. I tried to download the source code
as referenced in the chm file but it is corrupted. I cut and pasted from my
softcopy of the book.

I see the next sub-chapter on wxWindows for python and the previous
sub-chapter on TK. This is looking a lot like other scripting languages
(such as perl and groovy and even java). Can python call anything directly
or does someone have to write a DLL in C/C++ that calls the function first?
Thanks!
Siegfried
Sep 14 '08 #1
3 1154
On Sat, 13 Sep 2008 23:51:39 -0700, Siegfried Heintze wrote:
I see the next sub-chapter on wxWindows for python and the previous
sub-chapter on TK. This is looking a lot like other scripting languages
(such as perl and groovy and even java). Can python call anything
directly or does someone have to write a DLL in C/C++ that calls the
function first? Thanks!

I'm not sure I understand your question correctly, but Python can call
external programs in a number of ways. I believe the "best" way to do so
is with the subprocess module.

--
Steven
Sep 14 '08 #2
Siegfried Heintze wrote:
I just finished reading a chapter in "Python Programming on Win32" and tried
out the pythonwin scribble application. I'm not sure if I got it right
because I could not open a new document. I tried to download the source code
as referenced in the chm file but it is corrupted. I cut and pasted from my
softcopy of the book.

I see the next sub-chapter on wxWindows for python and the previous
sub-chapter on TK. This is looking a lot like other scripting languages
(such as perl and groovy and even java). Can python call anything directly
or does someone have to write a DLL in C/C++ that calls the function first?
Thanks!
Siegfried
See the ctypes module for a method of calling any C callable function in
and DLL.

Gary Herron

Sep 14 '08 #3
On 2008-09-14, Siegfried Heintze <si*******@heintze.comwrote:
I just finished reading a chapter in "Python Programming on Win32" and tried
out the pythonwin scribble application. I'm not sure if I got it right
because I could not open a new document. I tried to download the source code
as referenced in the chm file but it is corrupted. I cut and pasted from my
softcopy of the book.

I see the next sub-chapter on wxWindows for python and the
previous sub-chapter on TK. This is looking a lot like other
scripting languages (such as perl and groovy and even java).
Can python call anything directly
No. For example, I don't believe there's any way for standard
C-Python to make system calls on Linux. [Thought ISTR that
somebody has written an extension module that doess that.]
or does someone have to write a DLL in C/C++ that calls the
function first?
Can you be more explicit? What sort of "function" are you
talking about?

As for calling functions in libraries, the library doesn't have
to be in C/C++. Python can make library calls written in any
language (Fortran, Ada, Pascal, etc.) as long as the language
uses a supportted API. Python can also execute external
programs.

--
Grant
Sep 14 '08 #4

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

Similar topics

0
by: Marc ENGEL | last post by:
Hi all, I coded a python COM object that runs in a pythonw local server as a STA. This object creates and advises a VC++ COM object to receive its event. Those events are sent by worker...
7
by: Rene Pijlman | last post by:
Section 6.5 "What is delegation?" of the FAQ says: "Python programmers can easily implement delegation. For example, the following class implements a class that behaves like a file but converts...
8
by: Will | last post by:
I just discovered Python and looked briefly at one of the tutorials for beginners... It looks a lot like the old Command line Basic... I'm sure it does much more but... 1 - Can you create...
0
by: Mathias Mamsch | last post by:
Hi all, I got a problem with writing a python extension module which launches a bunch of C threads (currently under windows). The module launches a complete speech recognition engine in a new...
10
by: Chris Green | last post by:
Good day, I've done a bit of searching in the language reference and a couple pages referring the behavior of super() but I can't find any discussion of why super needs the name of the class as...
34
by: Ben Sizer | last post by:
I've installed several different versions of Python across several different versions of MS Windows, and not a single time was the Python directory or the Scripts subdirectory added to the PATH...
4
by: zane.selvans | last post by:
Hi there, I've been banging my head against this for a day, and I can't take it anymore. It's probably a stupid error, but I don't see where. I'm trying to use Python to call an external...
11
by: MonkeeSage | last post by:
A quick question about how python parses a file into compiled bytecode. Does it parse the whole file into AST first and then compile the AST, or does it build and compile the AST on the fly as it...
162
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.