473,498 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to mimik a main() function to start a program with entry point?

hello all.
I have one simple query and may be that's to stupid to answer but I am
not finding the answer any ways.
I have a set of modules in my package and out if which one is my
actual starting point to my entire program. say for example I have an
entire database application ready and I want a main (as in java or c)
to initiate the program and may be bring up a login screen and then
pass the control on to the main window.
if I am giving raw source code that is easy because I will tell user
to run the command ./xyz.py which has that function.
but if I freze it into an executable with py2exe for example , how do
I solve this problem?
thanks.
Krishnakant.
Jan 19 '07 #1
3 1108

krishnakant Mane wrote:
I have a set of modules in my package and out if which one is my
actual starting point to my entire program. say for example I have an
entire database application ready and I want a main (as in java or c)
to initiate the program and may be bring up a login screen and then
pass the control on to the main window.
if I am giving raw source code that is easy because I will tell user
to run the command ./xyz.py which has that function.
but if I freze it into an executable with py2exe for example , how do
I solve this problem?

If you cannot figure that out, you should not selling software.

if __name__ == '__main__':
#whatever

Jan 19 '07 #2
def main():
print "Hello"

if __name__ == "__main__":
main()

Simply verify __name__ and run any function from there. This will cause
main() to be run if the script is run directly. I haven't used py2exe,
so I'm not sure if it still applies.

--Kevin


krishnakant Mane wrote:
hello all.
I have one simple query and may be that's to stupid to answer but I am
not finding the answer any ways.
I have a set of modules in my package and out if which one is my
actual starting point to my entire program. say for example I have an
entire database application ready and I want a main (as in java or c)
to initiate the program and may be bring up a login screen and then
pass the control on to the main window.
if I am giving raw source code that is easy because I will tell user
to run the command ./xyz.py which has that function.
but if I freze it into an executable with py2exe for example , how do
I solve this problem?
thanks.
Krishnakant.
Jan 19 '07 #3
krishnakant Mane wrote:
hello all.
I have one simple query and may be that's to stupid to answer but I am
not finding the answer any ways.
I have a set of modules in my package and out if which one is my
actual starting point to my entire program. say for example I have an
entire database application ready and I want a main (as in java or c)
to initiate the program and may be bring up a login screen and then
pass the control on to the main window.
if I am giving raw source code that is easy because I will tell user
to run the command ./xyz.py which has that function.
but if I freze it into an executable with py2exe for example , how do
I solve this problem?
thanks.
Krishnakant.
See http://www.artima.com/weblogs/viewpost.jsp?thread=4829
by GvR himself.

j

--
Joshua Kugler
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/ Â*ID 0xDB26D7CE

--
Posted via a free Usenet account from http://www.teranews.com

Jan 20 '07 #4

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

Similar topics

45
3553
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes...
15
2860
by: Fred Zwarts | last post by:
In C++ execution of a program starts already before execution of main(). The initialization of static variables defined outside the scope of main is performed first. I could imagine a program where...
75
9804
by: Beni | last post by:
I have been programming in C for about a year now. It sounds silly, but I never took the time to question why a C(or C++ or Java) program execution begins only at the main(). Is it a convention or...
5
1844
by: Guruz | last post by:
hi C gurus do anyone of u know how to write a program in C without main and still create a executable out of it. Remember, I said no main() function not in -->include files -->libraries -->no...
6
1620
by: Marc | last post by:
I am just starting out teaching myself C#, and I have come accross a confusing point in my book. It seems that any class can have a Main() function, but what does that mean? Is the Main() function...
37
2357
by: Spidey | last post by:
How can to write a c program without a main() so i can compile and run it
13
2417
by: robinsonreyna | last post by:
Hi everyone Is it possible to write a program which do not have a main() function. The program should compile and run. Please give sample code to do this.
5
3948
by: Premkumar | last post by:
a.cpp ---------------------------------- #include <iostream> using namespace std; void mymain() { cout<<"my-main"<<endl; } ----------------------------------
0
2177
by: raylopez99 | last post by:
I ran afoul of this Compiler error CS1612 recently, when trying to modify a Point, which I had made have a property. It's pointless to do this (initially it will compile, but you'll run into...
0
7124
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
7163
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
7200
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...
1
6884
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...
1
4904
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4586
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.