Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40474

Python script not working on windows 7 but works fine on linux

From io <maroso@libero.it>
Subject Python script not working on windows 7 but works fine on linux
Newsgroups comp.lang.python
Date 2013-03-04 19:06 +0000
Message-ID <5134f0d1$0$40360$4fafbaef@reader1.news.tin.it> (permalink)
Organization TIN.IT (http://www.tin.it)

Show all headers | View raw


The following scripts are working fine on linux but, using the same 
version, can't work on windows because i receive the following message:

Script:


import json
import urllib
import csv

url = "http://bitcoincharts.com/t/markets.json"
response = urllib.urlopen(url);
data = json.loads(response.read())

f = open("/home/io/btc_trading/markets.csv","wb")
c = csv.writer(f)

#apre un file di testo e legge il contenuto del file inserendolo in una 
stringa
esclusioni_file = open('/home/io/btc_trading/exclusions.txt','r')
esclusioni = []

for line in esclusioni_file:
     esclusioni.append(line.strip())
#print(esclusioni)


# write headers
c.writerow(["Currency","Symbol","Bid", "Ask", "Volume"])

for d in data :
    if d["currency"] <> "SLL":  #esclude la valuta di secondlife SLL
        if d["bid"] is not None and d["ask"] is not None:
            if d["symbol"] not in esclusioni:
                #print d["symbol"]
                c.writerow([str(d["currency"]),str(d["symbol"]),str(d
["bid"]),str(d["ask"]),str(d["currency_volume"])])
    #esclusioni.close()

Windows error :

Traceback (most recent call last):
  File "C:\btc_trading\scripts
\import_json_2_csv_from_web_and_exclusions.py", line 10, in <module>
    f = open("/home/io/btc_trading/markets.csv","wb")
IOError: [Errno 2] No such file or directory: '/home/io/btc_trading/
markets.csv'
>>> 

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Python script not working on windows 7 but works fine on linux io <maroso@libero.it> - 2013-03-04 19:06 +0000
  Re: Python script not working on windows 7 but works fine on linux Christian Gollwitzer <auriocus@gmx.de> - 2013-03-04 20:20 +0100
    Re: Python script not working on windows 7 but works fine on linux io <maroso@libero.it> - 2013-03-04 19:58 +0000
  Re: Python script not working on windows 7 but works fine on linux ian douglas <iandouglas736@gmail.com> - 2013-03-04 11:20 -0800
    Re: Python script not working on windows 7 but works fine on linux io <maroso@libero.it> - 2013-03-04 19:59 +0000
      Re: Python script not working on windows 7 but works fine on linux Chris Angelico <rosuav@gmail.com> - 2013-03-05 07:56 +1100
    Re: Python script not working on windows 7 but works fine on linux Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-05 01:58 +0000
      Re: Python script not working on windows 7 but works fine on linux Andrew Berg <bahamutzero8825@gmail.com> - 2013-03-04 20:25 -0600
    Re: Python script not working on windows 7 but works fine on linux 88888 Dihedral <dihedral88888@googlemail.com> - 2013-03-04 18:58 -0800
    Re: Python script not working on windows 7 but works fine on linux 88888 Dihedral <dihedral88888@googlemail.com> - 2013-03-04 18:58 -0800
  Re: Python script not working on windows 7 but works fine on linux Wolfgang Strobl <news4@mystrobl.de> - 2013-03-04 20:30 +0100
  Re: Python script not working on windows 7 but works fine on linux Terry Reedy <tjreedy@udel.edu> - 2013-03-04 16:19 -0500

csiph-web