#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    6
    Rep Power
    0

    Py2exe?? Error: Nothing to do?


    I am trying to turn one of my .py files into an exe and I created a setup script and everything, but when i do the follwing "python myscript.py py2exe" I get an error saying "Error: Nothing to do"

    What did i do wrong and how do i fix it, thanks.
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    103
    Rep Power
    11
    because you didnt point to the setup.py file...i think.im still pretty new to,but i think your setup.py is what needs to be targeted.like for me,on a winxp machine,i opened a cmd prompt and changed to the directory of my setup.py(i keep myscript.py in there to) then did:
    python23\python.exe setup.py py2exe

    if you want to add a custom icon, add the line "icon_file=YourIconName.ico" to your setup.py and run this:
    python23\python.exe setup.py py2exe --icon "path\to\icon\file"

    hope that helps.if not,check out the stuff on the py2exe page.scroll down to "using py2exe".also on that page,near the bottom,it lists the flags
    It is not important if the glass is half full or half empty.What is important,is who has been drinking from MY glass?!?!?
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    6
    Rep Power
    0
    ok, now i got another problem.

    I did manage to get it into an exe, thanks very much for helping me. When i run the .py file as normally, it works just fine, but for some reason the .exe file just gives me an error, i didnt move anything around after it created the files and stuff, i just click on it and this is what i got...

    warning: name 'st' is assigned to before global declaration
    Traceback (most recent call last):
    File "imputil.pyc", line 106, in _import_hook
    ImportError: No module named warnings

    yet like i said, it still works if i run it when its .py, so why wouldnt it work when its an exe??
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Basically what seems to be going on is py2exe hasnt incuded the warning module. probably since there was no need for it before py2exe compiled it.

    You could try telling py2exe to import the warnings module using the -i flag. Also, i don't know if this works with py2exe, i have a feeling it does, but you could try turning warnings off.

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

  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    6
    Rep Power
    0
    Thanks for replying, I was just now coming here to post that I didnt need any more help, but thank you anyways. I did manage to figure it out on my own according to a common error in py2exe, so i used "--force-imports warnings" on it and got it to work.

    Also i figured out how to do the icon thing, but according to py2exe's website it can only be done on XP. I am using win98 but i can use my brothers computer for that. If there is a to specify an icon on win98 that would be great, if not, dont stress your self because most likely I will either figure it out my self with google searches or just use my bro's computer.

IMN logo majestic logo threadwatch logo seochat tools logo