[Tutor] AttributeError: 'module' object has no attribute 'start'

jason sam user0873 at gmail.com
Thu Jun 12 18:42:12 CEST 2014


Thnx for all the suggestions...Now i have made amendments to my program and
its working now...but there is a new problem now....I am now calling a
python script generated by GNU Radio Companion(for those who know about GRC
will understand my question better)...when i press the execute button i get
the following error..Both files are as attached.Is there a different way to
call a script generated by GRC??

Form: <class 'gnuradio.wxgui.forms.forms.text_box'> ->  Error translating
value: "<__main__.MyFrame; proxy of <Swig Object of type 'wxFrame *' at
0x30f44a0> >"
    bad operand type for abs(): 'MyFrame'
    Enter a float with optional scale suffix.  E.g., 100.1M
Form: <class 'gnuradio.wxgui.forms.forms.slider'> ->  Error translating
value: "<__main__.MyFrame; proxy of <Swig Object of type 'wxFrame *' at
0x30f44a0> >"
    unsupported operand type(s) for -: 'MyFrame' and 'float'
    Value should be within slider range
Using Volk machine: avx_64_mmx_orc
Traceback (most recent call last):
  File "wxgui.py", line 26, in Execute
    self.aNewFrame = uhd_fft.uhd_fft(self)
  File "/home/ali/Desktop/WXGUI/uhd_fft.py", line 155, in __init__
    size=((-1, 400)),
  File
"/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/fftsink_gl.py", line
126, in __init__
    persist_alpha=persist_alpha,
  File
"/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/fft_window.py", line
304, in __init__
    self.update_grid()
  File
"/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/fft_window.py", line
401, in update_grid
    baseband_freq - sample_rate/2.0,
TypeError: unsupported operand type(s) for -: 'MyFrame' and 'float'
Traceback (most recent call last):
  File
"/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/forms/forms.py",
line 102, in <lambda>
    widget.Bind(EVT_DATA, lambda x: self._update(x.data))
  File
"/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/forms/forms.py",
line 248, in _update
    def _update(self, value): self._text_box.SetValue(value);
self._update_color()
  File
"/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_controls.py",
line 1754, in SetValue
    return _controls_.TextCtrl_SetValue(*args, **kwargs)
TypeError: String or Unicode type required
Traceback (most recent call last):
  File
"/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/forms/forms.py",
line 102, in <lambda>
    widget.Bind(EVT_DATA, lambda x: self._update(x.data))
  File
"/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/forms/forms.py",
line 181, in _update
    def _update(self, value): self._slider.SetValue(int(round(value)))
TypeError: a float is required




On Thu, Jun 12, 2014 at 6:39 PM, Alan Gauld <alan.gauld at btinternet.com>
wrote:

> On 12/06/14 05:51, jason sam wrote:
>
>> Hi All,
>> I am new to wxPython.I have made a simple GUI that contains a button and
>> by pressing that button i am calling another .py
>> file(top_block.py)...
>>
>
> No you are not.
> You are importing it and then trying to access something called start
> which doesn't exist. importing is not the same as running a script.
> For a start the _name__ attribute will not be __main__ so your if clause
> at the bottom won't be executed. But the class definition
> code will have been run so you can access and create those classes
> from your wxGUI module.
>
> However, it is very strange practice to try to create a second
> GUI program from a first (not totally unheard of but uncommon).
> More usually you would define a dialog and open that from
> your Execute method.
>
>
>  top_block.start()
>>
>> The error is:
>>
>> AttributeError: 'module' object has no attribute 'start'
>>
>
> Please always post the full error message not just a summary.
> It has all sorts of useful extra details in there. In this case it doesn't
> matter because as the error says your module has no start attribute -
> because you didn't create one.
>
>
>
>  code are also welcome.The same error is received when i
>> use'top_block.run()'.Is there any alternative to this commands?
>>
>
> Yep, you didn't define a run() function either.
> modules can only execute what you define within them (and one or two
> special case attributes defined by Python; all starting with __
>
> Thee are several other oddities in your code but this is
> probably enough for now.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.flickr.com/photos/alangauldphotos
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140612/998053c1/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uhd_fft.py
Type: text/x-python
Size: 9220 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20140612/998053c1/attachment-0002.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wxgui.py
Type: text/x-python
Size: 914 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20140612/998053c1/attachment-0003.py>


More information about the Tutor mailing list