Guess, it is not the main executable, if permissions are an indicator.

On Fri, Dec 9, 2011 at 8:12 AM, Megha Vishwanath <[email protected]
> wrote:

> No luck:
>
> Traceback (most recent call last):
>   File "/home/megha/www/www_mock/www_mock.wsgi", line 46, in <module>
>     sysconnection = DBUtil.getSysConnection()
> AttributeError: 'module' object has no attribute 'getSysConnection'
>
>
> On Thu, Dec 8, 2011 at 11:57 PM, andrei <[email protected]> wrote:
>
>> Try this: touch code.wsgi (assuming code.wsgi is your main executable)
>>
>>
>> On Dec 8, 7:57 pm, megha <[email protected]> wrote:
>> > Hi All,
>> >
>> > I'm at my wit's end, trying to figure out why this is happening. It's
>> > likely to be a "python" related misunderstanding, but I want to be
>> > sure I'm using wsgi & web.py correctly as well. My question is wrt an
>> > AttributeError when I add a new method to an existing utility Module,
>> > because web.py is not recognizing that the source has changed.
>> >
>> > This is my root dir
>> >
>> > \www
>> >    \Utility
>> >       __init__.py (empty)
>> >       DBUtil.py
>> >
>> > DBUtil.py had these contents:
>> >
>> > import psycopg2
>> > import os
>> > from ConfigParser import SafeConfigParser
>> >
>> > def getConnection():
>> >     config = SafeConfigParser()
>> >     config.read(os.path.join(os.getcwd(),'config/dbconfig.ini'))
>> >     db = config.get('Database','dbname')
>> >     username = config.get('Database','user')
>> >     passwd = config.get('Database','passwd')
>> >     dsn = "dbname="+db+" user="+username+" host='localhost'
>> > password="+passwd
>> >     connection = psycopg2.connect(dsn)
>> >     return connection
>> >
>> > I had to bring in another DB connection so I added:
>> >
>> > def getSysConnection():
>> >     config = SafeConfigParser()
>> >     config.read(os.path.join(os.getcwd(),'config/dbconfig.ini'))
>> >     db = config.get('SysDatabase','sysdbname')
>> >     username = config.get('SysDatabase','sysuser')
>> >     passwd = config.get('SysDatabase','syspasswd')
>> >     dsn = "dbname="+db+" user="+username+" host='localhost'
>> > password="+passwd
>> >     connection = psycopg2.connect(dsn)
>> >     return connection
>> >
>> > I know web.py supports multidb, but I don't have time to reformat a
>> > lot of the existing db usage.
>> >
>> > So, when I add this method and recompile it with command line python
>> > this second method getSysConnection always throws me an Attribute
>> > Error. Also I was not sure if the module was set up right so I moved
>> > DButil.py into the same directory as the wsgi file and tried
>> > referencing the methods, without success.
>> >
>> > If I try using this util in a python shell, it works ok. Is this a
>> > problem with the way I compile the modified file. If I just delete
>> > the .pyc and restart apache, the .pyc isn't getting recreated either.
>> >
>> > Any response may help me here.
>> >
>> > Thanks
>> > -Megha
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "web.py" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/webpy?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to