def make_pdf(self):
self.get_filez()
self.get_client()
file_name = self.client_id+\"_\"+self.client_name+\"_\"+self.batch_num
style =
Try to print file_name after each line, to see if somebody is removing the "file_name" variable from your namespace.
In addition, to be more pythonic (and efficient), use
file_name = "_".join((self.client_id, self.client_name, self.batch_num))
to concatenate strings.
If you're assigning file_name
here:
file_name = self.client_id+"_"+self.client_name+"_"+self.batch_num
And you're getting a NameError
reporting, that file_name is not defined, then try wrapping the operation in a try..except
, to see what is going wrong:
try:
file_name = self.client_id+"_"+self.client_name+"_"+self.batch_num
except NameError as err:
print err, 'failed, here is some debug stuff:'
print "CLIENT ID =", self.client_id
print "CLIENT NAME =", self.client_name
print "BATCH NUM =", self.batch_num
If any of this is failing, this will set you on the course to finding out why and narrowing down the cause of it.
Mysterious NameErrors may arise from your file containing invisible control characters. On unix machines, you can spot these errors by looking at the output of
cat -A filename.py