Quantcast

ImportError: No module named nflgame

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ImportError: No module named nflgame

Thufir
Fairly basic usage, but how do I use PIP from Jython?  The package is
installed:



thufir@doge:~/jython$
thufir@doge:~/jython$ jython nfl.py
"my" variable $jythonHome masks earlier declaration in same scope at
/usr/bin/jython line 15.
Traceback (most recent call last):
   File "nfl.py", line 2, in <module>
     import nflgame
ImportError: No module named nflgame
thufir@doge:~/jython$
thufir@doge:~/jython$ pip show nflgame
Name: nflgame
Version: 1.2.20
Summary: An API to retrieve and read NFL Game Center JSON data. It can
work with real-time data, which can be used for fantasy football.
Home-page: https://github.com/BurntSushi/nflgame
Author: Andrew Gallant
Author-email: [hidden email]
License: UNLICENSE
Location: /home/thufir/.local/lib/python2.7/site-packages
Requires: beautifulsoup4, pytz, httplib2
thufir@doge:~/jython$
thufir@doge:~/jython$ cat nfl.py
#!python
import nflgame

games = nflgame.games(2013, week=1)
players = nflgame.combine_game_stats(games)
for p in players.rushing().sort('rushing_yds').limit(5):
  msg = '%s %d carries for %d yards and %d TDs'
  print msg % (p, p.rushing_att, p.rushing_yds, p.rushing_tds)



thufir@doge:~/jython$





thanks,

Thufir

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ImportError: No module named nflgame

Debabrata Pani
Hi Thufir,

Can you share the output of  "which pip" command ?
Probably nflgame is installed with "python" and not with "jython"

Regards,
Debabrata Pani

On Tue, Jan 17, 2017 at 12:20 AM, Thufir Hawat <[hidden email]> wrote:
Fairly basic usage, but how do I use PIP from Jython?  The package is
installed:



thufir@doge:~/jython$
thufir@doge:~/jython$ jython nfl.py
"my" variable $jythonHome masks earlier declaration in same scope at
/usr/bin/jython line 15.
Traceback (most recent call last):
   File "nfl.py", line 2, in <module>
     import nflgame
ImportError: No module named nflgame
thufir@doge:~/jython$
thufir@doge:~/jython$ pip show nflgame
Name: nflgame
Version: 1.2.20
Summary: An API to retrieve and read NFL Game Center JSON data. It can
work with real-time data, which can be used for fantasy football.
Home-page: https://github.com/BurntSushi/nflgame
Author: Andrew Gallant
Author-email: [hidden email]
License: UNLICENSE
Location: /home/thufir/.local/lib/python2.7/site-packages
Requires: beautifulsoup4, pytz, httplib2
thufir@doge:~/jython$
thufir@doge:~/jython$ cat nfl.py
#!python
import nflgame

games = nflgame.games(2013, week=1)
players = nflgame.combine_game_stats(games)
for p in players.rushing().sort('rushing_yds').limit(5):
  msg = '%s %d carries for %d yards and %d TDs'
  print msg % (p, p.rushing_att, p.rushing_yds, p.rushing_tds)



thufir@doge:~/jython$





thanks,

Thufir

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ImportError: No module named nflgame

Thufir
Exactly the problem.  How do I install PIP packages with Jython?




thufir@doge:~/NetBeansProjects/nfl$
thufir@doge:~/NetBeansProjects/nfl$ which pip
/home/thufir/.local/bin//pip
thufir@doge:~/NetBeansProjects/nfl$
thufir@doge:~/NetBeansProjects/nfl$ pip -V
pip 9.0.1 from /home/thufir/.local/lib/python2.7/site-packages (python 2.7)
thufir@doge:~/NetBeansProjects/nfl$
thufir@doge:~/NetBeansProjects/nfl$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
thufir@doge:~/NetBeansProjects/nfl$
thufir@doge:~/NetBeansProjects/nfl$ jython -V
"my" variable $jythonHome masks earlier declaration in same scope at
/usr/bin/jython line 15.
Jython 2.5.3
thufir@doge:~/NetBeansProjects/nfl$




thanks,

Thufir

On 1/16/17, Debabrata Pani <[hidden email]> wrote:

> Hi Thufir,
>
> Can you share the output of  "which pip" command ?
> Probably nflgame is installed with "python" and not with "jython"
>
> Regards,
> Debabrata Pani
>
> On Tue, Jan 17, 2017 at 12:20 AM, Thufir Hawat <[hidden email]>
> wrote:
>
>> Fairly basic usage, but how do I use PIP from Jython?  The package is
>> installed:
>>
>>
>>
>> thufir@doge:~/jython$
>> thufir@doge:~/jython$ jython nfl.py
>> "my" variable $jythonHome masks earlier declaration in same scope at
>> /usr/bin/jython line 15.
>> Traceback (most recent call last):
>>    File "nfl.py", line 2, in <module>
>>      import nflgame
>> ImportError: No module named nflgame
>> thufir@doge:~/jython$
>> thufir@doge:~/jython$ pip show nflgame
>> Name: nflgame
>> Version: 1.2.20
>> Summary: An API to retrieve and read NFL Game Center JSON data. It can
>> work with real-time data, which can be used for fantasy football.
>> Home-page: https://github.com/BurntSushi/nflgame
>> Author: Andrew Gallant
>> Author-email: [hidden email]
>> License: UNLICENSE
>> Location: /home/thufir/.local/lib/python2.7/site-packages
>> Requires: beautifulsoup4, pytz, httplib2
>> thufir@doge:~/jython$
>> thufir@doge:~/jython$ cat nfl.py
>> #!python
>> import nflgame
>>
>> games = nflgame.games(2013, week=1)
>> players = nflgame.combine_game_stats(games)
>> for p in players.rushing().sort('rushing_yds').limit(5):
>>   msg = '%s %d carries for %d yards and %d TDs'
>>   print msg % (p, p.rushing_att, p.rushing_yds, p.rushing_tds)
>>
>>
>>
>> thufir@doge:~/jython$
>>
>>
>>
>>
>>
>> thanks,
>>
>> Thufir
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Jython-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/jython-users
>>
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ImportError: No module named nflgame

Jeff Allen-2
Hi Thufir,

There is quite good support for pip beginning Jython 2.7 on Linux, for
which I believe we have to thank Jim Baker. You want a 2.7 version of
Python anyway, because nflgame (nfldb) offers to work only with 2.6 or
2.7. For a start, it uses str.format, and I think I'm correct in saying
that it wasn't available in 2.5.

Thanks for trying this with Jython: I tried this for myself and got a
little further than you. I have Jython 2.7.0 installed at ~/Jython2.7.0
(so I don't need root), but I thought I'd see in virtualenv worked for
me, since I've little lasting interest in football.

I made this work on Linux Mint:
1.    Put the Jython bin directory first on your path ("export
PATH=~/Jython2.7.0/bin"), and check using which pip that you get
Jython's version of pip.
2.    "pip install virtualenv" will give you virtualenv in your (home)
jython installation.
3.    Now cd to where you want to work and "jython -m virtualenv jve"
will install you an environment called jve.
4.    ". jve/bin/activate" will activeate it (note it is "bin" not
"Scripts"). Now "which pip" should show an executable in the virtual
environment.
5    "pip install nflgame" starts well, but here I ran out of heap
space. :( You may have better luck: my Linux laptop is quite small.

I was able to install gallows (a small console game) the same way,
without the heap problem, although for some reason gallows.py landed in
the bin directory, not in site-packages. After moving the file, the game
worked.

Sorry this is not a canned solution, but maybe this gets you onto more
interesting problems.

Jeff Allen

On 17/01/2017 12:39, Thufir wrote:

> Exactly the problem.  How do I install PIP packages with Jython?
>
>
>
>
> thufir@doge:~/NetBeansProjects/nfl$
> thufir@doge:~/NetBeansProjects/nfl$ which pip
> /home/thufir/.local/bin//pip
> thufir@doge:~/NetBeansProjects/nfl$
> thufir@doge:~/NetBeansProjects/nfl$ pip -V
> pip 9.0.1 from /home/thufir/.local/lib/python2.7/site-packages (python 2.7)
> thufir@doge:~/NetBeansProjects/nfl$
> thufir@doge:~/NetBeansProjects/nfl$ cat /etc/lsb-release
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=16.04
> DISTRIB_CODENAME=xenial
> DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
> thufir@doge:~/NetBeansProjects/nfl$
> thufir@doge:~/NetBeansProjects/nfl$ jython -V
> "my" variable $jythonHome masks earlier declaration in same scope at
> /usr/bin/jython line 15.
> Jython 2.5.3
> thufir@doge:~/NetBeansProjects/nfl$
>
>
>
>
> thanks,
>
> Thufir
>
> On 1/16/17, Debabrata Pani <[hidden email]> wrote:
>> Hi Thufir,
>>
>> Can you share the output of  "which pip" command ?
>> Probably nflgame is installed with "python" and not with "jython"
>>
>> Regards,
>> Debabrata Pani
>>
>> On Tue, Jan 17, 2017 at 12:20 AM, Thufir Hawat <[hidden email]>
>> wrote:
>>
>>> Fairly basic usage, but how do I use PIP from Jython?  The package is
>>> installed:
>>>
>>>
>>>
>>> thufir@doge:~/jython$
>>> thufir@doge:~/jython$ jython nfl.py
>>> "my" variable $jythonHome masks earlier declaration in same scope at
>>> /usr/bin/jython line 15.
>>> Traceback (most recent call last):
>>>     File "nfl.py", line 2, in <module>
>>>       import nflgame
>>> ImportError: No module named nflgame
>>> thufir@doge:~/jython$
>>> thufir@doge:~/jython$ pip show nflgame
>>> Name: nflgame
>>> Version: 1.2.20
>>> Summary: An API to retrieve and read NFL Game Center JSON data. It can
>>> work with real-time data, which can be used for fantasy football.
>>> Home-page: https://github.com/BurntSushi/nflgame
>>> Author: Andrew Gallant
>>> Author-email: [hidden email]
>>> License: UNLICENSE
>>> Location: /home/thufir/.local/lib/python2.7/site-packages
>>> Requires: beautifulsoup4, pytz, httplib2
>>> thufir@doge:~/jython$
>>> thufir@doge:~/jython$ cat nfl.py
>>> #!python
>>> import nflgame
>>>
>>> games = nflgame.games(2013, week=1)
>>> players = nflgame.combine_game_stats(games)
>>> for p in players.rushing().sort('rushing_yds').limit(5):
>>>    msg = '%s %d carries for %d yards and %d TDs'
>>>    print msg % (p, p.rushing_att, p.rushing_yds, p.rushing_tds)
>>>
>>>
>>>
>>> thufir@doge:~/jython$
>>>
>>>
>>>
>>>
>>>
>>> thanks,
>>>
>>> Thufir
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Jython-users mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/jython-users
>>>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Jython-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jython-users
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Loading...