Tuesday, May 3, 2016

Python path seems to be KO in a deleguate design class A class B

Hi,

Trying to delegate class A features to class B in python, I encounter this error :


Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<string>", line 16, in PyExecReplace
File "<string>", line 27, in <module>
File "<string>", line 23, in __init__
NameError: global name 'DatingObj' is not defined



___________
In Vim my PYTHONPATH is void :
echo "@".$PYTHONPATH."@" gives me @@.

This is the source code :

class DatingObj(): # Dating considerations
def __init__(self):
self.periodList = [ 'Today', 'Yesterday', 'ThisWeek' ]
def getCurrentDay(self):
from datetime import datetime
lastHourDateTime = datetime.today()
return lastHourDateTime.strftime('%Y-%m-%d')
def getYesterday(self):
from datetime import datetime, timedelta
lastHourDateTime = datetime.today() - timedelta(days = 1)
return lastHourDateTime.strftime('%Y-%m-%d')
def getCurrentHour(self):
from datetime import datetime
lastHourDateTime = datetime.today()
return lastHourDateTime.strftime('%Y-%m-%d %H:%M:%S')
def getCurrentLastHour(self):
from datetime import datetime, timedelta
lastHourDateTime = datetime.today() - timedelta(hours = 1)
return lastHourDateTime.strftime('%Y-%m-%d %H:%M:%S')

class UserChoice():
def __init__(self):
self.test = DatingObj()



myUsrChoice = UserChoice()


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: