dimanche 20 décembre 2020

ModuleNotFoundError: No module named 'random'

I am trying to import random in Pycharm, however I keep getting this error 'ImportError: cannot import name random' , I am clueless i have tried also reinstalling the random library but still?

Code:

def randomizer(trans_field,gps):


x=random.uniform(-0.42,0.42)
y=0.095
z=random.uniform(-0.42,-0.42)

print(randrange(3, 9))
trans_field.setSFVec3f( [x,y,z] )  
print("light position: ",x,y,z)
print("coordinates of the robot: ",gps.getValues() )

Error traceback:

File "my_controller.py", line 23, in randomizer x=random.uniform(-0.42,0.42) NameError: global name 'random' is not defined




Aucun commentaire:

Enregistrer un commentaire