Skip to content

Commit 0cdcf52

Browse files
committed
Bugfixing
1 parent 24e7829 commit 0cdcf52

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

ec2.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
from boto.ec2.connection import EC2Connection
2222

2323
# My libraries
24-
import ec2_classes
24+
try:
25+
import ec2.ec2_classes as ec2_classes
26+
except ImportError:
27+
import ec2_classes
2528

2629
#### Constants and globals
2730

ec2_classes.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
ec2_classes.py
33
~~~~~~~~~~~~~~
44
5-
Defines the Cluster and Instance classes used by `ec2.py`. These
6-
classes are put in a separate module because `ec2.py` stores instances
7-
of these classes by pickling (through shelves), and ...
8-
5+
Defines the Cluster and Instance classes used by `ec2.py`.
96
"""
107

8+
# Why are these classes stored in a separate module from ec2.py?
9+
#
10+
# These classes are put in a separate module because ec2.py stores
11+
# instances of these classes by pickling (through shelves). Pickling
12+
# classes defined within ec2.py creates namespace problems that can be
13+
# solved by putting the class definitions into a separate module. See:
14+
#
15+
# http://stackoverflow.com/questions/3614379/attributeerror-when-unpickling-an-object
16+
1117
#### Cluster and Instance classes
1218

1319
class Cluster():

0 commit comments

Comments
 (0)