ah, progress...

ant ant at anthive.com
Wed Dec 19 12:22:08 EST 2018


ant wrote:
> ant wrote:
>
> ...
>
>   script was there, but the package was not actually
> installed.
>
>   after installing again i get:
>
>=====
>
> (env) me at ant(26)~/src/test$ ngfp
> Traceback (most recent call last):
>   File "/home/me/src/env/bin/ngfp", line 7, in <module>
>     from ngfp import main
> ImportError: cannot import name 'main' from 'ngfp' (/home/me/src/salsa/env/lib/python3.7/site-packages/ngfp/__init__.py)
>
>=====
>
>   i'm not sure if this is because my __init__.py is
> another directory deeper (my project has a top level
> directory with the setup.py in it and then the
> ngfp directory with the __init__.py in it which 
> contains the following:
>
>=====
> name = "ngfp"
>=====
>
>   which obviously says nothing about main...
> i hate being a newbie.
>
>   but at least i'm making progress.  :)


hmmm, but my main is defined in ngfp.py


=====

...


def main():
    window = Window(width=cfg.img_pix*(cfg.game_cols+cfg.control_cols+3), height=cfg.img_pix*(cfg.game_rows+2), caption="Ngfp", resizable=True, fullscreen=False, visible=False)
    pyglet.clock.schedule_interval(window.update, 1/120.0) # update at 60Hz
    pyglet.app.run()


if __name__ == "__main__":
    main()


=====


  when i'm in the directory with the source code:


$ python3 ngfp.py


works exactly as it should.


  ant


More information about the Python-list mailing list