Ciaran O Brien
Ciaran O Brien

Reputation: 384

wxPython not finding attributes

I'm at wits end. I am trying to work with Gooey and wxPython with Python 3.9.0 Please find a snippet of my code below.


@Gooey(program_name="My App", required_cols= 3, optional_cols = 2, default_size=(710, 700))
def parse_args():

    parser = GooeyParser(description='Test App)

    parser.add_argument('Names',
                        action='store',
                        widget='FileChooser',
                        help="Upload Your File Containing Names")

    parser.add_argument('Addresses',
                        action='store',
                        widget='FileChooser',
                        help="Upload Your File Containing Addresses")
    
    args = parser.parse_args()
    return args

args = parse_args()
  

When trying to run my code on my work laptop, I receive the following error.

File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\wx\__init__.py", line 12, in <module>
   __version__ = wx.__version__.VERSION_STRING

AttributeError: module 'wx' has no attribute '__version__'

I have navigated to this folder and can indeed see the __version__.py file.

Is there any reason why wxPython would not be able to recognise and import its own attributes? Any help welcomed. I can give more information if needed.

Upvotes: 1

Views: 199

Answers (1)

Rolf of Saxony
Rolf of Saxony

Reputation: 22448

I'm not convinced that:

wx.__version__.VERSION_STRING

would ever work, as wx.__version__ returns a string, as does wx.version()

On Linux: $ python

Python 3.9.6 (default, Jun 29 2021, 00:00:00) 
[GCC 11.1.1 20210531 (Red Hat 11.1.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> wx.__version__
'4.0.7'
>>> wx.version().split()
['4.0.7', 'gtk3', '(phoenix)', 'wxWidgets', '3.0.5']
>>> wx.version().split()[0]
'4.0.7'
>>> 

If none of the above work, I'd suggest that something is wrong with your installation.
Nothing in your question, offers an explanation as to where the error is generated, as there is no Traceback, so given that pure wx call demonstrably works under python 3.9, the problem could reside in some other module (pafy), that itself utilises wx.
Other than that, I can't be of more help.

Upvotes: 1

Related Questions