Errors trying to run code - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Errors trying to run code (/thread-22189.html) |
Errors trying to run code - ziggyztz - Nov-03-2019 I'm very new to python and received some help to create the code, but it isn't super complicated. I am receiving the following errors when trying to run the code. I tried searching for a solution. I added the path environment, uninstalled python and reinstalled, and tried this solution: https://bugs.python.org/msg353736. I don't know enough about what these errors mean to search for a better solution.
RE: Errors trying to run code - Larz60+ - Nov-03-2019 It's hard to figure out what you are trying to do. try taking this one step at a time.
RE: Errors trying to run code - ziggyztz - Nov-03-2019 Ok thank you for the response. I think the issue is something with my pc setup. My friend said they got the code to run for himself. I'm playing a game that can be run with a client that supports python and has it's own library of functions native to the game. That's the py_game stuff. I have a library of functions that uses py_game and some things that I want to do in-game. The script I'm trying to run is supposed to attack the closest enemy. I guess the first step is I'm trying to import the py_game library and mylibrary. Then search for all items within a range, filter to enemies, put them in a list, then determine which is closest to attack. import py_game import mylibrary py_game.SetFindDistance(10) while True: searchList = mylibrary.findItems(-1,-1) attackables = [] for it in searchList: if py_game.IsNPC(it): if it != py_game.Self() and py_game.GetNotoriety(it) > 2: attackables.append(it) closest = min(attackables,default=None,key=py_game.GetDistance) if closest: py_game.UseSecondaryAbility() py_game.Attack(closest) py_game.Wait(500) py_game.Wait(20)The mylibrary starts with these imports if it's relevant: import py_game import threading import enum import time import requests import datetime I think I've figured it out. With all the errors, I was in information overload, but needed to focus on the final line: I added that in command line with python -m pip install requests and everything is working now.
RE: Errors trying to run code - newbieAuggie2019 - Nov-03-2019 Hi! According to this: (Nov-03-2019, 03:48 AM)ziggyztz Wrote: The mylibrary starts with these imports if it's relevant: and the last lines of your error message: (Nov-03-2019, 02:40 AM)ziggyztz Wrote: I would say that either you haven't installed the module 'requests' on your version of python or that you have more than one version of python installed. To see what version of python you have installed, you can type python -V in your Windows command prompt (not sure if you are using Mac).To install the module 'requests' in the version of python you are running, type pip install requests in your Windows command prompt.Another thing that comes to mind is that according to the message from your link, it seems that it could be related to python 3.8 as I think I've read that some people are having trouble trying to run some modules on it. All the best, P.S.: Great! It seems that you worked it out! All the best, |