For several years, I was using the python 2.x version that was available from the IBM Tools & Toys page, but I really wanted to start using a 3.x version, so I downloaded 3.6.1 from your site. The install went fairly well, but I found that none of the programs I had coded would run any longer. I found a solution to this problem (right or wrong) that by coding
as the second line (#!/bin/env being the first) of the program, this seemed to fix my problem and have been using it since.
Recently, however, I started trying to put some commonly used functions in a separate source file, and calling them from other programs I had written, something like this:
from email_f import mail_it
When I run the main program, this is the result I get:
Traceback (most recent call last):
File “./email_m.py”, line 5, in
File “/u/sfr640/python/email_f.py”, line 1
SyntaxError: invalid syntax
To me, this seems like it might be another encoding issue, where the main program is not reading in the function module properly. I have verified that the function module will run fine as a stand alone program, but fails if it is imported by the other program.
Would you have any suggestions how I could get around this issue? Thanks.
Make sure you have _BPXK_AUTOCVT=ON set in your environment, and be sure to tag all source files using chtag. In general, keeping source encoded as ASCII (ISO-8859-1, aka IBM 819) and properly tagged will help you avoid encoding problems.
Thanks very much for your reply. I did have _BPXK_AUTOCVT=ON, so I recreated the file as ASCII and made sure it was tagged appropriately, and it now works perfectly. Thanks again.