Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bot wont boot up : ValueError: Expecting property name #966

Closed
mehdi-S opened this issue Jul 26, 2016 · 24 comments
Closed

bot wont boot up : ValueError: Expecting property name #966

mehdi-S opened this issue Jul 26, 2016 · 24 comments

Comments

@mehdi-S
Copy link

mehdi-S commented Jul 26, 2016

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: c4c3487

@douglascamata
Copy link
Member

I committed fix, please test.

@mehdi-S
Copy link
Author

mehdi-S commented Jul 26, 2016

after git pull :
git log : 4555466

-> # 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)

@hero16
Copy link

hero16 commented Jul 26, 2016

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

@BScreen
Copy link

BScreen commented Jul 26, 2016

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

@ngkogkos
Copy link

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

@mehdi-S
Copy link
Author

mehdi-S commented Jul 26, 2016

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 }
    }
}

@ngkogkos
Copy link

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

@douglascamata
Copy link
Member

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

@BScreen
Copy link

BScreen commented Jul 26, 2016

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 👍

@mehdi-S
Copy link
Author

mehdi-S commented Jul 26, 2016

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

@ngkogkos
Copy link

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

@mehdi-S
Copy link
Author

mehdi-S commented Jul 26, 2016

@ngkogkos
trying with and without, not the issue here

@mehdi-S
Copy link
Author

mehdi-S commented Jul 26, 2016

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

@BScreen
Copy link

BScreen commented Jul 26, 2016

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?

@ironbishop
Copy link

yep, not a valid JSON with that last comma

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

@ngkogkos
Copy link

Exactly. Same for the "catch" key also

@tpmodding
Copy link

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?! :/

@ironbishop
Copy link

@tpmodding files could increase in future

@mehdi-S
Copy link
Author

mehdi-S commented Jul 26, 2016

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

@tpmodding
Copy link

tpmodding commented Jul 26, 2016

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

@mehdi-S
Copy link
Author

mehdi-S commented Jul 26, 2016

@tpmodding dont you try to use /configs/ instead of ./configs/ or configs/ ?

@tpmodding
Copy link

it shouldn matter? if i start with "python pokecli.py" shouldnt it auto-load from configs/config.json? or am i wrong?

@gpires
Copy link

gpires commented Jul 26, 2016

Change the last lines of the config to:

    "catch": {
      "any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "and"}
    },
    "release": {
      "any": {"release_below_cp": 340, "release_below_iv": 0, "logic": "or"}
    }
}

The problem is the comma....

@mehdi-S
Copy link
Author

mehdi-S commented Jul 26, 2016

for the moment, this issue is closed

Solution :

Don't forget is you want to get rid of the // "Rattata": { "always_release" : true } line in

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

object, to also remove comma after
"any": {"release_below_cp": 0, "release_below_iv": 0, "logic": "or"},
line like so
"any": {"release_below_cp": 0, "release_below_iv": 0, "logic": "or"}

do the same for the catch line and you're good to go !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants