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

Fixed Encrypt file name in Windows platform #4193

Merged
merged 1 commit into from
Aug 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,11 @@ def update_web_location(self, cells=[], lat=None, lng=None, alt=None):
cells = self.find_close_cells(*location)

user_data_cells = os.path.join(_base_dir, 'data', 'cells-%s.json' % self.config.username)
with open(user_data_cells, 'w') as outfile:
json.dump(cells, outfile)
try:
with open(user_data_cells, 'w') as outfile:
json.dump(cells, outfile)
except IOError as e:
self.logger.info('[x] Error while opening location file: %s' % e)

user_web_location = os.path.join(
_base_dir, 'web', 'location-%s.json' % self.config.username
Expand Down Expand Up @@ -711,10 +714,10 @@ def get_encryption_lib(self):
full_path = path + '/'+ file_name
if not os.path.isfile(full_path):
self.logger.error(file_name + ' is not found! Please place it in the bots root directory or set encrypt_location in config.')
self.logger.info('Platform: '+ _platform + ' Encrypt.so directory: '+ path)
self.logger.info('Platform: '+ _platform + ' ' + file_name + ' directory: '+ path)
sys.exit(1)
else:
self.logger.info('Found '+ file_name +'! Platform: ' + _platform + ' Encrypt.so directory: ' + path)
self.logger.info('Found '+ file_name +'! Platform: ' + _platform + ' ' + file_name + ' directory: ' + path)

return full_path

Expand Down Expand Up @@ -848,8 +851,11 @@ def current_inventory(self):

user_web_inventory = os.path.join(_base_dir, 'web', 'inventory-%s.json' % self.config.username)

with open(user_web_inventory, 'w') as outfile:
json.dump(inventory_dict, outfile)
try:
with open(user_web_inventory, 'w') as outfile:
json.dump(inventory_dict, outfile)
except IOError as e:
self.logger.info('[x] Error while opening location file: %s' % e)

# get player items stock
# ----------------------
Expand Down
7 changes: 5 additions & 2 deletions pokemongo_bot/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,8 +1071,11 @@ def refresh(self):
i.refresh(inventory)

user_web_inventory = os.path.join(_base_dir, 'web', 'inventory-%s.json' % (self.bot.config.username))
with open(user_web_inventory, 'w') as outfile:
json.dump(inventory, outfile)
try:
with open(user_web_inventory, 'w') as outfile:
json.dump(inventory, outfile)
except IOError as e:
errmsg = '[x] Error while opening location file: user_web_inventory'

def retrieve_item_inventory_size(self):
"""
Expand Down