m3talstorm / foe-bot

:robot: A simple bot to automate the main functions of Forge of Empires (FoE)
MIT License
45 stars 15 forks source link

Monitor requires curses (not installed) #5

Closed DanAtkinson closed 7 years ago

DanAtkinson commented 7 years ago

Hi there,

I had a quick play and found that the main.py script works without issue.

However, when I ran the monitor.py script, I got an error that curses wasn't installed.

I grabbed curses from here and installed it with python -m pip install curses-2.2-cp27-none-win_amd64.whl.

Processing d:\temp\curses-2.2-cp27-none-win_amd64.whl
Installing collected packages: curses
Successfully installed curses-2.2

Now, when I run python monitor.py I get the following:

Traceback (most recent call last):
  File "monitor.py", line 32, in <module>
    wrapper(main)
  File "C:\Python27\lib\curses\wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "monitor.py", line 28, in main
    monitor.run()
  File "D:\Github\foe-bot\foe\monitors\monitor.py", line 66, in run
    self.render()
  File "D:\Github\foe-bot\foe\monitors\building_monitor.py", line 77, in render
    colour)
_curses.error: addstr() returned ERR

Any pointers would be much appreciated. Maybe you have a different curses installed?

m3talstorm commented 7 years ago

Hi @DanAtkinson Sorry I didn't see your message, I only just realized that I didn't have notifications (watching) turned on for this repo :(

From my understanding curses is part of Python.

_curses.error: addstr() returned ERR

Is from your window/terminal/screen being to small (vertically) to print the text, either make your window/terminal bigger or look here and reduce the number of buildings it displays at once.

If you have and actual fix rather than a workaround feel free to submit a PR.

DanAtkinson commented 7 years ago

Yep, that'll be it. I increased the terminal size (I use Cmder) and it ran. I think a simple check for the terminal size might help.

DanAtkinson commented 7 years ago

Also, as an aside, curses definitely wasn't installed and I had to install that before I got the error message in my first comment.

sammeowww commented 6 years ago

I've experienced similar problem, as my screen is not wide enough, change the width solved the problem File: foe/monitors/monitor.py

class Monitor(object):
    SEPERATOR = 140 * '-'

Change to

class Monitor(object):
    SEPERATOR = 115 * '-'