This is the correct syntax.

db.export_to_csv_file(open('somefile.csv', 'wb'))

the problem is that db.does not see the models. Are you using?

python -S app -M -N -R yourscript.py

On Nov 15, 12:39 am, mart <msenecal...@gmail.com> wrote:
> Hi,
>
> Since connecting remotely is an issue for now, I went to the server
> hosting the MSSQL DB.
>
> I am cinnecting fine (to localhost), but this cmd :
>
> db.export_to_csv_file('quickbuild.csv')
>
> is getting this error:
>
>   File "C:\Documents and Settings\buildmonkey\Desktop\blue_framework
> copy\src\mssql_test.py", line 33, in main
>     db.export_to_csv_file('quickbuild.csv')
> ...
> dal.py", line 2193, in export_to_csv_file
>     ofile.write('END')
> AttributeError: 'str' object has no attribute 'write'
>
> I did not get an error when doing verbatim what the book says:
>
> db.export_to_csv_file(open('somefile.csv', 'wb'))
>
> but this only yielded one word in the target file, 'END'
>
> Any idea what I should be looking at?
>
> Thanks,
> Mart :)

Reply via email to