Public Group

# noob python questions

This topic is 3349 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Heyas, I am new to python and was hoping you could help me in a special situation. A program I am using provides a python interpreter and I am able to script a few lines in order to make the program do what I want (at least in most of the cases^^). Therefore, the program offers classes which allow the user to access and modify certain states of the program (like turn a switch or "click" a button). I am sure you know what I mean. I took a look into the depths of the folder where this program lies and was able to find plenty of *.pyc files, which hold all the names of the classes and functions I am using for scripting. Since the interpreter of the program itself is realy buggy and is most anoying to use, I started scripting with eclipse/pydev which helps quite a bit especially when you are not used to the python syntax. Coming to my question: Is there a way to use those *.pyc files in order for the intelisense of eclipse to work? I was not able to find any *.py files, as they must be hidden or something. The only other file that might help is a *.mdf file that seems to some kind of header:
#*****************************************************************************
# cdautomationlib.mdf
# Copyright (c) 2000 by ****** GmbH
#
# Version 2.0.0.0
MODULENAME cdautomationlib
DESCRIPTION ControlDesk Main Automation library All neccessary classes general ControlDesk automation are implemented in here.

GROUP cdautomationlib
GROUP Application
FUNCTION ArrangeWindows
DESCRIPTION Arrange the windows inside the work area.
END_FUNCTION
FUNCTION EditMode
DESCRIPTION Set edit mode for layouts,
CALL OBJ.EditMode()
END_FUNCTION
FUNCTION Hide
DESCRIPTION Hides the controldesk window
CALL OBJ.Hide()
END_FUNCTION
FUNCTION Maximize
DESCRIPTION Maximize the ControlDesk window.
CALL OBJ.Maximize()
END_FUNCTION


Is this of any use? Is there a way to compile my files without creating dummy class representations? I hope I could make myself clear and there is a way for me to include those classes and functions. Thanks in advance for any hint / link / suggestion! Regards Woltan

##### Share on other sites
It's possible to disassemble .pyc files (in fact, a disassembler is included with Python), but that's not going to be of much help. Because Python is a dynamic language, even parsing .py files for intellisense stuff is far from difficult; add in the loss of the semantic annotations inherent in source code, and it becomes impossible in all but the simplest situations.

I'm not familiar with that MDF format, but it appears to be part of a binding generator. It would conceivably be possible to convert it into a stub .py file that defined all the relevant methods for the sake of intellisense.

##### Share on other sites
Something which might help are these two functions: dir and help. If you just call dir() from the interpreter, it should give you a list of everything defined in the scope. Call dir(something) on one of those things, and you'll get a list of everything defined in that something (everything accessible by something.anotherthing). Call help(something) on something and you'll be given it's documentation, assuming there is any. These two help replace intellisense-like features and are quite helpful.

##### Share on other sites
Hi,
first of all, thx for your postings. I figure, the work I'd have to put into it to get intellisense is quite a lot more than I would get out of it. After all the interface to the classes inside the program are reduced to a minimum, so having intellisense of my own classes must suffice this time. However, I'll keep those hints in mind just in case I come accross a similar problem.
Thx again
cherio Woltan

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633736
• Total Posts
3013601
×