KevinJohnson

12-22-2011, 05:22 PM

i'm getting the following error when trying to divide by numbers inside of a list. I'm a little new to Python, and i was wondering how i can fix this problem.

sphere.py:23: Deprecation Warning: integer argument expected, got float

for y in range(notch[x] / 360):

import math

## Generate a Sphere in 3d Space

def sphere(r, lx, ly, lz):

for i in range(0,360):

lx.append(math.cos(i) * r)

ly.append(math.sin(i) * r)

lz.append(math.cos(i) * r)

## Generate a list of possible Lock positions

def GenPositions(NotchList, n):

notch = []

a1 = 180

r = .5

# Generate a List of Smallest Slice angles

for i in range(n):

notch.append(a1 * (r ** (i-1)))

# Generate a final list of Notches

for x in range(1,len(notch)):

for y in range(notch[x] / 360):

NotchList.append(notch[x] * y)

# Test - Generate sphere coordinates

lx = []

ly = []

lz = []

tmp = sphere(10, lx, ly, lz)

for i in range(len(lx)):

print lx[i], ly[i], lz[i]

print

print "There are " + str(len(lx)) + " vertices"

# Test - Generate Lock positions

NotchList = []

tmp = GenPositions(NotchList, 64)

for i in range(1,len(NotchList)):

print i, NotchList[i]

sphere.py:23: Deprecation Warning: integer argument expected, got float

for y in range(notch[x] / 360):

import math

## Generate a Sphere in 3d Space

def sphere(r, lx, ly, lz):

for i in range(0,360):

lx.append(math.cos(i) * r)

ly.append(math.sin(i) * r)

lz.append(math.cos(i) * r)

## Generate a list of possible Lock positions

def GenPositions(NotchList, n):

notch = []

a1 = 180

r = .5

# Generate a List of Smallest Slice angles

for i in range(n):

notch.append(a1 * (r ** (i-1)))

# Generate a final list of Notches

for x in range(1,len(notch)):

for y in range(notch[x] / 360):

NotchList.append(notch[x] * y)

# Test - Generate sphere coordinates

lx = []

ly = []

lz = []

tmp = sphere(10, lx, ly, lz)

for i in range(len(lx)):

print lx[i], ly[i], lz[i]

print "There are " + str(len(lx)) + " vertices"

# Test - Generate Lock positions

NotchList = []

tmp = GenPositions(NotchList, 64)

for i in range(1,len(NotchList)):

print i, NotchList[i]