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." ...
    ▼ Local vars <http://pavements2.ce.utexas.edu:8888/txcit/prjs#> 
   VariableValue self
   <pymssql.pymssqlCursor object at 0x9bc6c0c>
    - /usr/lib/python2.7/site-packages/web/db.py in iterwrapper 
   1. row = db_cursor.fetchone() ...
    ▼ Local vars <http://pavements2.ce.utexas.edu:8888/txcit/prjs#> 
   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() ...
    ▼ Local vars <http://pavements2.ce.utexas.edu:8888/txcit/prjs#> 
   VariableValue i
   0
   self
   <web.utils.IterBetter instance at 0x9bc6d0c>
   

-- 
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 webpy@googlegroups.com.
To unsubscribe from this group, send email to 
webpy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to