ActivePython discussion

Python and ActivePython usage questions; Python practices and programming questions

Problems installing IMSL Library for PyNL

I have windows 7
All PyNL prerequisites are installed and working properly (I have Python 2.7.11, pip version 9.0.1, NumPy 1.11.3, SciPy 0.18.1)
I Downloaded the installation file to a temporary folder
When I Open a command prompt and enter:

pip install
I get the following :

"Could not find a version that satisfies the requirement downloaded
No matching distribution found for downloaded"

When I Open a command prompt and enter:

pip install imsl-1.0_eval-cp27-none-win_amd64.whl

I get the following :

How do I get bsddb on windows/python3.5?

The ActivePython 3.5 User Guide states: "ActivePython includes the Python core and the many core extensions: zlib and bzip2 for data compression, the Berkeley DB (bsddb) and SQLite (sqlite3) database libraries." I have been looking for information on how to use it. Please point to any doc that can help.

Why do I get Python 2.7 installed along with Python 3.4

I installed ActiveState python 3.4, When do I see Python 2.7 also getting installed? Does Python 3.4 has any dependency on 2.7?

Compile SQLite with ICU (International Components for Unicode)

SQLite only understands upper/lower case for ASCII characters by default. The LIKE operator is case sensitive by default for unicode characters that are beyond the ASCII range.

Hello due to this (default) limitation in SQLite there can occur some problems with using the LIKE operator. Is it possible for you to include SQLite compiled with ICU support on Windows?

enabling multiple file types

Using the latest versions of ActiveState TCL (8.6.4.1 or 8.5.18.0) with Mac OS 10.10, the selection of different file types for selecting a file is not enabled. Here is a snippet of code:

if demfile == None:
self.file_opt = options = {}
options['filetypes'] = [('All files', '*'),('ASCII files', '*.asc')]
options['initialdir'] = scoops.DefaultDir
fname = tkFileDialog.Open(**self.file_opt).show()

else:
fname = demfile

Python Metaclass Bases lay-out Conflicts issue

All,

I am facing some issues in Python Metaclasses when I am trying to do Multiple inheritance.

from traits.api import HasTraits

class Sample1(AnotherClass, HasTraits):
    pass

For the above code, it was throwing

metaclass conflict: the metaclass of a derived class must be a (non-strict)

Then I changed the code like this

from traits.api import HasTraits

class Sample1_Meta(type(HasTraits), type(AnotherClass)):
    pass

class Sample1(AnotherClass, HasTraits):
    __metaclass__ = Sample1_Meta

python functions

```
def manipulate_data(string,data):
#accepts string and manipulate data
if string=='list':
return"list.reverse"
elif string=='set':
set.add("ANDELA")
set.add("TIA")
set.add("AFRICA")
return set.result
elif string=='dictionary':
return s.keys()

#call the function with an ARGUMENT
manipulate_data(list,[25,16,9,4,1])
manipulate_data(set,{"ANDELA","TIA","AFRICA"})
manipulate_data(dictionary,{'apples','oranges','mangoes','grapes'})
```

Python - find and replace lower case to upper case in text file

Hi guys,

I'm totally new to python and am embarking on my first project.

I have a text file saved on my computer and I would like to know how to replace the lowercase letter "i" with the uppercase letter "I".

The python version I have is Python 3.4.3

Would you guys have any suggestions on how to even start?

Thanks,

Speakup

Could any one PLEASE help with this exercise?....its a school project and i have no idea how to handle it..

'''Define a class tnode to represent nodes in a tree according to
following specifications. Each object type is a node but also tnode
tree whose root and 'the node itself. The class has the following methods.
- Constructor with parameter name, creating a node named name, initially
childless.
- Add (c) adds c end of the list of children of the node. It is assumed that c is
type tnode.
- Children () returns a copy of the list of children.
- Height () returns the height of the tree, that 'the maximum number of nodes in
a root-leaf path.

problem installing py2cairo package

All;
I'm not a big python person, so forgive me if my questions are somewhat elementary. I have ActiveStates python 2.7.8 installed. I setup a virtualenv and am trying to install py2cairo 1.10.0. However, I'm getting the following error message.

(env)python:~/Graphite/py2cairo-1.10.0>./waf configure
./options()
Setting top to : /root/Graphite/py2cairo-1.10.0
Setting out to : /root/Graphite/py2cairo-1.10.0/build_directory
./configure()
Checking for 'gcc' (c compiler) : ok