PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

bot wont boot up : ValueError: Expecting property name

Open mehdi-S opened this issue 10 years ago • 24 comments

Expected Behavior

start normally

Actual Behavior

-> # sudo python pokecli.py -cf ./configs/config.json
[06:46:21] PokemonGO Bot v1.0
Traceback (most recent call last):
  File "pokecli.py", line 250, in <module>
    main()
  File "pokecli.py", line 229, in main
    config = init_config()
  File "pokecli.py", line 57, in init_config
    load.update(json.load(data))
  File "/usr/lib/python2.7/json/__init__.py", line 290, in load
    **kw)
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Expecting property name: line 22 column 7 (char 607)

Steps to Reproduce

git clone latest build on dev branch doing initial step edit the config.json file

Other Information

OS: Debian x64_86 Git Commit: c4c34875c7af8d8ffdcc18e76b0ea0f0146c2422

mehdi-S avatar Jul 26 '16 10:07 mehdi-S

I committed fix, please test.

douglascamata avatar Jul 26 '16 11:07 douglascamata

after git pull : git log : 4555466ed1801f401e99670b17a9c98f4cb4ebb9

-> # sudo python pokecli.py -cf ./configs/config.json
[07:08:16] PokemonGO Bot v1.0
Traceback (most recent call last):
  File "pokecli.py", line 250, in <module>
    main()
  File "pokecli.py", line 229, in main
    config = init_config()
  File "pokecli.py", line 57, in init_config
    load.update(json.load(data))
  File "/usr/lib/python2.7/json/__init__.py", line 290, in load
    **kw)
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Expecting property name: line 22 column 7 (char 607)

mehdi-S avatar Jul 26 '16 11:07 mehdi-S

im getting the same error as above with lastest pull. just to confirm

hero16 avatar Jul 26 '16 11:07 hero16

I get a different error:

$ python pokecli.py
[13:23:45] PokemonGO Bot v1.0
Traceback (most recent call last):
  File "pokecli.py", line 250, in <module>
    main()
  File "pokecli.py", line 229, in main
    config = init_config()
  File "pokecli.py", line 55, in init_config
    if os.path.isfile(config_arg):
  File "/Users/***/Desktop/PokemonGo-Bot/_dev/PokemonGo-Bot/lib/python2.7/genericpath.py", line 37, in isfile
    st = os.stat(path)
TypeError: coercing to Unicode: need string or buffer, NoneType found

BScreen avatar Jul 26 '16 11:07 BScreen

Ensure that there is no comma separator in the last json value.

ngkogkos avatar Jul 26 '16 11:07 ngkogkos

here is the last line of my json config file, just to eject this possibility

{
    ...
    "use_lucky_egg": false,
    "evolve_captured": false,
    "catch": {
      "any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"},
      // "Rattata": { "always_catch" : true }
    },
    "release": {
      "any": {"release_below_cp": 500, "release_below_iv": 0.8, "logic": "and"},
      // "Rattata": { "always_release" : true }
    }
}

mehdi-S avatar Jul 26 '16 11:07 mehdi-S

Try to completely remove the catch and release keys, and also the leftover comma friom the "evolve_captured" key afterwards.

ngkogkos avatar Jul 26 '16 11:07 ngkogkos

@mehdi-S you have a malformed son in the configuration. Check for commas

douglascamata avatar Jul 26 '16 11:07 douglascamata

I've been following this thread and after cleaning the catch and release keys I used the command posted by @mehdi-S sudo python pokecli.py -cf ./configs/config.json and now everything seems to be working fine 👍

BScreen avatar Jul 26 '16 11:07 BScreen

what you see is exactly the defaut config.json.exemple with my value, so maybe the typo is also in the default file and need to be corrected

works fine without the catch/release key to confirm

mehdi-S avatar Jul 26 '16 11:07 mehdi-S

Is the parser fine with the // comments in the JSON structure?

ngkogkos avatar Jul 26 '16 11:07 ngkogkos

@ngkogkos trying with and without, not the issue here

mehdi-S avatar Jul 26 '16 11:07 mehdi-S

now the bot dont release anything anymore

and frequently get into

Traceback (most recent call last):
  File "pokecli.py", line 250, in <module>
    main()
  File "pokecli.py", line 241, in main
    bot.take_step()
  File "/root/PokemonGo-Bot-myprettyusername/pokemongo_bot/__init__.py", line 36, in take_step
    location = self.navigator.take_step()
  File "/root/PokemonGo-Bot-myprettyusername/pokemongo_bot/spiral_navigator.py", line 49, in take_step
    point = self.points[self.ptr]
IndexError: list index out of range

mehdi-S avatar Jul 26 '16 11:07 mehdi-S

The example config looks like this:

"release": {
      "any": {"release_below_cp": 0, "release_below_iv": 0, "logic": "or"},
      // "Rattata": { "always_release" : true }
    }

but since the last line is commented out there is one comma too much. It should be

"release": {
      "any": {"release_below_cp": 0, "release_below_iv": 0, "logic": "or"}
    }

right?

BScreen avatar Jul 26 '16 11:07 BScreen

yep, not a valid JSON with that last comma

Error: Parse error on line 9:
...logic": "or"     },      // "Rattata": { "alw
---------------------^
Expecting 'STRING', got 'undefined'

ironbishop avatar Jul 26 '16 11:07 ironbishop

Exactly. Same for the "catch" key also

ngkogkos avatar Jul 26 '16 11:07 ngkogkos

had the same issue, after deleting the catch lines it works only if i put the config in the root direct...on windows it doestn work in the configs file....and realy...do we need for only ONE file a dir?! :/

tpmodding avatar Jul 26 '16 11:07 tpmodding

@tpmodding files could increase in future

ironbishop avatar Jul 26 '16 11:07 ironbishop

@tpmodding you maybe are on the master branch, where configs/ folder dont exist already ?

mehdi-S avatar Jul 26 '16 11:07 mehdi-S

no i'm on dev, i have the dir but it works only when i put the file to pokecli.py and start with python pokecli.py -cf config.json

tpmodding avatar Jul 26 '16 11:07 tpmodding