ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Syntax errors in pychartdir.py
Posted by quantlabsnet on Aug-13-2019 12:43
This message continue from another posting of ' PYTHONPATH on Ubuntu Linux' on Jan 11 2019. I downloaded the most current ChartDirect Python version. I found many syntax errrors in the file.
Line 36, my Python interpreter (v 3.68 or Ubuntu Desktop 18.04), it generates an error with not like the L at the end of 0x03000000 so I added the correction.

if (dllVersion & 0xffff0000) != 0x03000000 : #0xffff0000L) != 0x03000000 :

There are quite a few more after this. Is the download Python current version correct for syntax free code?
Thanks

  Re: Syntax errors in pychartdir.py
Posted by quantlabs` on Aug-13-2019 16:19
I think after fixing errors, I am now getting:
Traceback (most recent call last):
  File "trendline.py", line 2, in <module>
    from pychartdir import *
  File "/usr/lib/python3/dist-packages/pychartdir.py", line 5, in <module>
    cdDll = __import__("pychartdir" + cdSysVer[0] + cdSysVer[2])
ImportError: /usr/lib/python3/dist-packages/pychartdir36.so: invalid ELF header


I have copied all the latest download ChartDirector/lib files into
/usr/lib/python3/dist-packages
but still get this invalid ELF header
Thanks

  Re: Syntax errors in pychartdir.py
Posted by Peter Kwan on Aug-13-2019 17:48
Hi quantabsnet,

The line you mentioned "if (dllVersion & 0xffff0000) != 0x03000000 :"  does not exist in the latest version of ChartDirector. I eventually found this line in a very old version of ChartDirector released around 15 years ago. At that time Python 3.x has not been invented yet, and so the ChartDirector script is designed for Python 1.x and 2.x. You probably already know that Python 3.x is not compatible with Python 2.x, and you cannot use Python 3.x to run Python 2.x code.

Are you using ChartDirector for the first time, or have you used older versions of ChartDirector before? In a typical ChartDirector for Python script, there is a line "from pychartdir import *" or "import pychartdir". If you machine has older version of ChartDirector for Python, it is possible for it to pick up the older "pychartdir.py" instead of the latest one you have downloaded. In particular, it is not uncommon for people to copy the "pychartdir.py" to the same directory is the charting script. When they move the script directory to a another machine, they also moved the old "pychartdir.py" to the new machine.  Please double check if you are using the latest "pychartdir.py" instead of an older copy.

The latest "pychartdir.py" is at "ChartDirector/lib/pychartdir.py" in the latest downloaded. The file date of "pychartdir.py" should be Sept 8, 2019. The file size should be 59338 bytes and line 36 should be "ret = c.__dict__.get("defaultArgs")".

Regards
Peter Kwan

  Re: Syntax errors in pychartdir.py
Posted by Peter Kwan on Aug-13-2019 18:15
Hi quantabsnet,

The "invalid ELF header" can occur if a shared object built for one operating system is used in a different operating system. For example, if a macOS "pychartdir36.so" is used in Linux (x86_64), or if a Linux (x86_64) shared object is used Linux (i386/i686), it will cause this type of error.

Please verify that you are using the ChartDirector for Python that is built for your type of Linux. You may use "uname -a" to determine if you are using Linux (x86_64) or Linux (i686).

If you have used ChartDirector for Python in another type of machine before, please check if you have copied the shared objects with your script to your Ubuntu machine. In this case, operating system may pick up the copied shared objects which is for your earlier operating system.

If the above still cannot solve the problem, would you mind to inform me of the result of the following:

cd /usr/lib/python3/dist-packages
pwd
uname -a
ls -l *.so

Regards
Peter Kwan

  Re: Syntax errors in pychartdir.py
Posted by quantlabs on Aug-14-2019 02:17
Your uname -a command hlped fix the conflict. Thanks


cix porn hard porn kostenlose porn amateur xxx love porn amateur sex hd porn free 3 xxx moblie porn