Skip to content

context_clean.py exception #11

@slawkory

Description

@slawkory

As I understand after compilation of PyNEC, component is added only for python2.7 so I used 2.7.
There was exception in my environment for
python2.7 dipole.py
Wavelength is 0.1224m, initial length is 0.0612m

Traceback (most recent call last):
  File "dipole.py", line 96, in <module>
    z = impedance(design_freq_mhz, initial_length, nr_segments)
  File "dipole.py", line 40, in impedance
    nec = geometry(freq_mhz, length, nr_segments)
  File "dipole.py", line 17, in geometry
    nec.set_extended_thin_wire_kernel(False)
  File "/home/(..)/python-necpp/PyNEC/example/context_clean.py", line 107, in set_extended_thin_wire_kernel
    self.context.set_extended_thin_wire_kernel(0)
  File "/usr/lib64/python2.7/site-packages/PyNEC.py", line 181, in set_extended_thin_wire_kernel
    return _PyNEC.nec_context_set_extended_thin_wire_kernel(self, ekflag)
TypeError: in method 'nec_context_set_extended_thin_wire_kernel', argument 2 of type 'bool'

To see example result I have added locally that change which works:

+++ b/PyNEC/example/context_clean.py
@@ -101,10 +101,10 @@ class context_clean(object):
     def set_extended_thin_wire_kernel(self, enable):
         if enable:
             debug ("EK", 0)
-            self.context.set_extended_thin_wire_kernel(1)
+            self.context.set_extended_thin_wire_kernel(True)
         else:
             debug ("EK", -1)
-            self.context.set_extended_thin_wire_kernel(0)
+            self.context.set_extended_thin_wire_kernel(False)

BTW: Is there any reconfiguration trick to install PyNec for Python3?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions