mssql (pymssql) error

217 views
Skip to first unread message

Andre Smit

unread,
Aug 12, 2011, 12:09:08 AM8/12/11
to we...@googlegroups.com

The following code return no data but the same query using pymssql works OK. I've included some of the the debug output - see anything?

[code]

import os, sys, web, json
prog_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(prog_dir)
urls = (
    '/'      , 'Index',
    '/prjs'  , 'Projects',
)
app = web.application(urls, globals())
application = app.wsgifunc()
templates_dir = os.path.join(prog_dir,'templates/')
render = web.template.render(templates_dir)
db = web.database(dbn='mssql',user='USER',pw='PW',db='TXCIT',host='myHOST')
#as_dict=True
web.config.debug = True

class Index:
   
    def GET(self):
        return render.index()

class Projects:
   
    def GET(self):
        dd = db.select('DB_HMA_PRJ')
        return dd[0].CONT_ID

[/code]

<class 'pymssql.OperationalError'> at /prjs

No data available.

Python /usr/lib/python2.7/site-packages/pymssql.py in fetchone, line 236
Web GET http://pavements2.ce.utexas.edu:8888/txcit/prjs

Traceback (innermost first)

  • /usr/lib/python2.7/site-packages/pymssql.py in fetchone
    1. raise OperationalError, "No data available." ...
    VariableValue
    self
    <pymssql.pymssqlCursor object at 0x9bc6c0c>
  • /usr/lib/python2.7/site-packages/web/db.py in iterwrapper
    1. row = db_cursor.fetchone() ...
    VariableValue
    db_cursor
    <pymssql.pymssqlCursor object at 0x9bc6c0c>
    names
    ['CONT_ID', 'PRJ_NBR', 'LN_ITM_NBR', 'TX_HMA', 'BLAT', 'ELAT', 'BLON', 'ELON']
  • /usr/lib/python2.7/site-packages/web/utils.py in __getitem__
    1. return self.i.next() ...
    VariableValue
    i
    0
    self
    <web.utils.IterBetter instance at 0x9bc6d0c>

进中关

unread,
Aug 12, 2011, 4:21:41 AM8/12/11
to we...@googlegroups.com
looks like some error happened in pymssql module.


2011/8/12 Andre Smit <freev...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "web.py" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webpy/-/dodOAxR7CEEJ.
To post to this group, send email to we...@googlegroups.com.
To unsubscribe from this group, send email to webpy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webpy?hl=en.

Xianming Mu

unread,
Jun 20, 2012, 4:49:23 AM6/20/12
to we...@googlegroups.com
Hi Andre,

I also encountered this "No data available" problem.
Have you solved it? Any suggestion would be appreciated!

花包

unread,
Jul 12, 2013, 9:46:24 AM7/12/13
to we...@googlegroups.com
i use web.py 0.37
i meet the same question.
i solove it with this way:
edit db.py line no 660 ,change if not self.ctx.transactions: to if not self.ctx.transactions and self.dbname!="mssql": 
bingo
wish to help you 

在 2011年8月12日星期五UTC+8下午12时09分08秒,Andre Smit写道:
Reply all
Reply to author
Forward
0 new messages