bmc / fortune

Python Fortune Program
http://software.clapper.org/fortune/
Apache License 2.0
69 stars 20 forks source link

EOFError #2

Open hugo-dc opened 11 years ago

hugo-dc commented 11 years ago

I'm getting the following error:

$ fortune
Traceback (most recent call last):
  File "c:\Python27\Scripts\fortune-script.py", line 9, in <module>
    load_entry_point('fortune==1.0', 'console_scripts', 'fortune')()
  File "c:\Python27\lib\site-packages\fortune-1.0-py2.7.egg\fortune\__init__.py", line    282, in main
    sys.stdout.write(get_random_fortune(fortune_file))
  File "c:\Python27\lib\site-packages\fortune-1.0-py2.7.egg\fortune\__init__.py", line 186, in get_random_fortune
    data = pickle.load(fortuneIndex)
EOFError

I'm on Windows (Msysgit). I'm using your fortune's database files.

hugo.delacruz@DELLE6430HUGO ~ $

bmc commented 11 years ago

You must either give the program the path to the fortune file, or you must set the FORTUNE_FILE environment variable to point to the file. Furthermore, the data file must also be present. What is FORTUNE_FILE set to in your environment? Is an appropriate fortune.dat file also present in the same location?

hugo-dc commented 11 years ago

I created the following path: ~/bin/fortune there I placed the file called fortunes I also have generated the fortune.dat file, when I faced the error I cloned your fortune and fortune.dat files from https://github.com/bmc/fortunes and I still have the same error, I created the environment variable in my .bashrc file: export FORTUNE_FILE=~/bin/fortunes/fortunes . Have you tested fortune in Windows?.

bmc commented 11 years ago

On May 24, 2013, at 4:45 PM, Jose Hugo De la cruz notifications@github.com wrote:

I created the following path: ~/bin/fortune there I placed the file called fortunes I also have generated the fortune.dat file, when I faced the error I cloned your fortune and fortune.dat files from https://github.com/bmc/fortunes and I still have the same error, I created the environment variable in my .bashrc file: export FORTUNE_FILE=~/bin/fortunes/fortunes . Have you tested fortune in Windows?

I haven't, not lately. I tend to use it on my Mac or on Linux, where I do 99% of my work. I'll test on Windows over the weekend.

-Brian

Brian Clapper, http://www.clapper.org/bmc/ Jones' Motto: Friends come and go, but enemies accumulate.

mattdistro commented 10 years ago

I ran into the same problem.

Changing line 185 to fortuneIndex = open(fortune_index_file, 'rb') solved it.