Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #16  
Old December 20th, 2003, 08:15 AM
darkleaf darkleaf is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: netherlands
Posts: 51 darkleaf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
I have a (hopefully small) problem with py2exe

I've played a bit with everything and I found a faster way to patch my program if needed.
So it now consists of different modules, one is the main one, from which every other will be imported.
I import an executable module that writes a file. The problem is that when I import this module to use it for py2exe, the command 'import module' executes this module, breaking the setup script.

I think this is an extension module? So it can't be included. The py2exe site says this:

Quote:
In simple cases, only pythonxx.dll is needed in addition to myscript.exe. If, however, your script needs extension modules, unfortunately those cannot be included or imported from the zip-archive, so they are needed as separate files (and are copied into the dist\myscript directory).


As it isn't included default now, how do I make it so that it's included. Do i just have to copy the .py extension files into the directory, or do I have to write it somwhere in the setup.py file, or do I have to use a command line command to include them?

Thanks for the help!

Reply With Quote
  #17  
Old December 20th, 2003, 02:00 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Very bad idea, if your going to write modular code i sugest you look into classes or at the very least functions and then call these from a main file..

Having a module which does somthing on import little scary; and hard to debug if somone else desided to use it as a base for another app.

I don't know how py2exe handles this kind of thing, but you should give the -i flag a go and see if that works for you.

Quote:
--excludes or -e list
comma separated list of modules to exclude
--includes or -i list
comma separated list of modules to include. Note that includes overrides excludes.


Mark.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #18  
Old December 20th, 2003, 04:07 PM
darkleaf darkleaf is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: netherlands
Posts: 51 darkleaf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Quote:
Originally posted by netytan
[B]Very bad idea, if your going to write modular code i sugest you look into classes or at the very least functions and then call these from a main file..

I know it's a bad idea, it was said in the tutorial as well, and if py2exe doesn't support it directly...
It looks like classes are what I want to use, going to give that a better look. I can't use the def statement, as my program is something like this:

user input in main script - call another script, depending on the input, that does the work - possibility to loop the main script.

That called script has some printed lines first giving a few hints to the user for what to do. (basically it's the input for and writing of the file in my above code but it's not really important what it is) If I use the def statement you have to input those variables between the ( and ) so the print lines will never never show up.

Quote:
Having a module which does somthing on import little scary; and hard to debug if somone else desided to use it as a base for another app.

I found that quite useful, actually. If someone wants to use it he can just pick the module and use it as well, no trouble with stuff that's defined in/by other scripts, immediately the right thing with everything that's needed, not more and not less. Though that's probably because I'm new

Quote:
I don't know how py2exe handles this kind of thing, but you should give the -i flag a go and see if that works for you.

I shall see if it works but if so I'll also start to make it so it's not needed.

Thanks for the help!!!

edit: saw a script using def with prints in it working so must be something i did/am doing wrong. Will look at that as well

Last edited by darkleaf : December 20th, 2003 at 04:27 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > running programs without python?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT