Python script not working on windows 7 but works fine on linux
ian douglas
iandouglas736 at gmail.com
Mon Mar 4 14:20:28 EST 2013
On 03/04/2013 11:06 AM, io wrote:
> esclusioni_file = open('/home/io/btc_trading/exclusions.txt','r')
>
> 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'
The error tells you everything you need to know: the file system has no
path/file called "/home/io/btc_trading/markets.csv"
I imagine your CSV file lives in a different location on your Windows 7
system (which also uses back-slashes '\' instead of forward-slashes '/',
so you'll need to maybe do a try/except around the open() call to open a
Windows path like open("c:\\users\\io\\Documents\\markets.csv") or
whatever. OR you'll need to do some OS detection ahead of time to set
the file path properly.
More information about the Python-list
mailing list