overviewer / Minecraft-Overviewer

Render high-resolution maps of a Minecraft world with a Leaflet powered interface
https://overviewer.org/
GNU General Public License v3.0
3.36k stars 481 forks source link

POI Gen Error #1130

Open Morketh opened 10 years ago

Morketh commented 10 years ago

i have an automated render set up with a cron job and when i run it i get an error while doing the POI render i believe it has something to do with my TIME POI but im not exactly sure

This is the error that occurred:

Traceback (most recent call last):
  File "/usr/bin/overviewer.py", line 587, in <module>
    ret = main()
  File "/usr/bin/overviewer.py", line 118, in main
    g.genPOI.main()
  File "/usr/lib/python2.7/dist-packages/overviewer_core/aux_files/genPOI.py", line 296, in main
    handlePlayers(rset, render, worldpath)
  File "/usr/lib/python2.7/dist-packages/overviewer_core/aux_files/genPOI.py", line 152, in handlePlayers
    'DIM1': 1}[rset.get_type()]
KeyError: 'DIM7'

heres my config file:

import datetime

DIM_TW_FOR = "true"

worlds["Day"]   = "/opt/minecraft/CollectiveIndustries"
worlds["Night"] = "/opt/minecraft/CollectiveIndustries"

outputdir = "/opt/overview/WWW"
texturepath = "/opt/overview/lib/1.7.2.jar"

### POI Defs ###

def signFilter(poi):
    if poi["id"] == "Sign":
      if poi["Text1"] == "TIME":
        return "Render Time: ".datetime.datetime.now()
      else:
            return " \n".join([poi["Text1"], poi["Text2"], poi["Text3"], poi["Text4"]])

def playerIcons(poi):
    if poi['id'] == 'Player':
        poi['icon'] = "http://overviewer.org/avatar/%s" % poi['EntityId']
        return "Last known location for %s" % poi['EntityId']

## POI FILTER ##
PlayerPOS = {"name":         "Players",
             "filterFunction": playerIcons,
             }

SignPOS = {"name":  "Signs",
       "filterFunction": signFilter,
       }

POI_Filters = [PlayerPOS, SignPOS]

### "dimension": "overworld"  ###

##  upper-left ##
renders["survivalday"] = {
    "world": "Day",
    "title": "UL",
    "rendermode": smooth_lighting,
    "dimension": "overworld",
    "markers": POI_Filters,
}
renders["survivalnight"] = {
    "world": "Night",
    "title": "UL",
    "rendermode": smooth_night,
    "dimension": "overworld",
    "markers": POI_Filters,
}
## upper-right ##

renders["survivalDayUR"] = {
    "world": "Day",
    "title": "UR",
    "rendermode": smooth_lighting,
    "dimension": "overworld",
    "northdirection" : "upper-right",
    "markers": POI_Filters,
}
renders["survivalNightUR"] = {
    "world": "Night",
    "title": "UR",
    "rendermode": smooth_night,
    "dimension": "overworld",
    "northdirection" : "upper-right",
    "markers": POI_Filters,
}

## lower-left ##

renders["survivalDayLL"] = {
    "world": "Day",
    "title": "LL",
    "rendermode": smooth_lighting,
    "dimension": "overworld",
    "northdirection" : "lower-left",
    "markers": POI_Filters,
}
renders["survivalNightLL"] = {
    "world": "Night",
    "title": "LL",
    "rendermode": smooth_night,
    "dimension": "overworld",
    "northdirection" : "lower-left",
    "markers": POI_Filters,
}

## lower-right ##
renders["survivalDayLR"] = {
    "world": "Day",
    "title": "LR",
    "rendermode": smooth_lighting,
    "dimension": "overworld",
    "northdirection" : "lower-right",
    "markers": POI_Filters,
}
renders["survivalNightLR"] = {
    "world": "Night",
    "title": "LR",
    "rendermode": smooth_night,
    "dimension": "overworld",
    "northdirection" : "lower-right",
    "markers": POI_Filters,
}

## TWILIGHT DIM 7 ##

if DIM_TW_FOR == "true":
##  upper-left ##
    renders["survivalTWday"] = {
            "world": "Day",
            "title": "UL",
            "rendermode": smooth_lighting,
            "dimension": "DIM7",
            "markers": POI_Filters,
    }
    renders["survivalTWnight"] = {
            "world": "Night",
            "title": "UL",
            "rendermode": smooth_night,
            "dimension": "DIM7",
            "markers": POI_Filters,
    }
## upper-right ##

    renders["survivalTWDayUR"] = {
            "world": "Day",
            "title": "UR",
            "rendermode": smooth_lighting,
            "dimension": "DIM7",
            "northdirection" : "upper-right",
            "markers": POI_Filters,
    }
    renders["survivalTWNightUR"] = {
            "world": "Night",
            "title": "UR",
            "rendermode": smooth_night,
            "dimension": "DIM7",
            "northdirection" : "upper-right",
            "markers": POI_Filters,
    }

## lower-left ##

    renders["survivalTWDayLL"] = {
        "world": "Day",
            "title": "LL",
            "rendermode": smooth_lighting,
            "dimension": "DIM7",
            "northdirection" : "lower-left",
            "markers": POI_Filters,
    }
    renders["survivalTWNightLL"] = {
            "world": "Night",
            "title": "LL",
            "rendermode": smooth_night,
            "dimension": "DIM7",
            "northdirection" : "lower-left",
            "markers": POI_Filters,
    }

## lower-right ##
    renders["survivalTWDayLR"] = {
            "world": "Day",
            "title": "LR",
            "rendermode": smooth_lighting,
            "dimension": "DIM7",
            "northdirection" : "lower-right",
            "markers": POI_Filters,
    }
    renders["survivalTWNightLR"] = {
            "world": "Night",
            "title": "LR",
            "rendermode": smooth_night,
            "dimension": "DIM7",
            "northdirection" : "lower-right",
            "markers": POI_Filters,
    }
else:
    print "Rendering for DIM-7 disabled untill found. I will check the time we render"
CounterPillow commented 10 years ago

Things that are wrong in your config but aren't the issue you're encountering

DIM_TW_FOR = "true"
if DIM_TW_FOR == "true":

why strings?

DIM_TW_FOR = True
if DIM_TW_FOR == True:

Furthermore

return "Render Time: ".datetime.datetime.now()

We're not writing php here, . does not concatenate strings in python. Furthermore, you can't just implicitly tell it to concatenate a datetime object to a string. Try

return "Render Time: " + datetime.datetime.now().strftime("%F at %T")

This error is not causing the crash though, as it'd only be encountered if the interpreter reached that point, as almost everything is a runtime error in python.

The actual issue you're encountering

The problem lies somewhere with the custom dimension, I may take a poke at this later. Thanks for reporting it.

Morketh commented 10 years ago

thank-you for helping clean up the config file the reason i was using a true statement (and should have been using a Boolean) is the folder detection for the dimension in issue #913 returned a working dimension and tried to run a render on that when Twilight Forest wasn't even spawned yet that resulted in a ton of errors and checking the folder structure there was a DIM7 there however as far as i could tell that part of the world had not been visited

Morketh commented 10 years ago

Well that pull request fixed half of the problem now im gettting this error

Traceback (most recent call last):
  File "/usr/bin/overviewer.py", line 587, in <module>
    ret = main()
  File "/usr/bin/overviewer.py", line 118, in main
    g.genPOI.main()
  File "/usr/lib/python2.7/dist-packages/overviewer_core/aux_files/genPOI.py", line 317, in main
    result = filter_function(poi)
  File "/opt/overview/overview_config.py", line 19, in signFilter
    return "Render Time: "+datetime.datetime.now().strftime("%d of %B")
NameError: global name 'datetime' is not defined

i have changed the formatting of the datetime as well as checking that i have

import time
import datetime

at the top of the configuration script as far as i could tell it should work ive even tried taking off the extra datetime so that it looks as so

return "Render Time: "+datetime.now().strftime("%d of %B")

ive also tried:

return "Render Time: %s " % datetime.datetime.now().strftime("%d of %B")

for the life of me i can't figure out this issue ive viewed examples of uses for the datetime around the internet and from what i can tell i have the formatting right and i have the import statements right but i know from Spencerian that this error is caused by a missing `import or a missing file that is being imported however setting up a time script and running it entirely independent from overviewer runs just fine

import time
import datetime

print("time now:" + datetime.datetime.now().strftime("%d of %B") )

im entirely lost as to what may be causing this error and want to make sure that its not on y'alls end

CounterPillow commented 10 years ago

Overviewer bug, likely somewhere in https://github.com/overviewer/Minecraft-Overviewer/blob/master/overviewer_core/configParser.py#L77-L79

Morketh commented 10 years ago

thanks for the pointer in the right direction i'll see if i can poke at it later today and see if cant fix it

mide commented 4 years ago

I've noticed a very similar issue that has led me to cram everything into the single filter function (nothing outside the function, including imports). You can see some past discussions about this here. Not a blocker, just passing along context if it's useful.