Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DPS Graph window does not load #40

Closed
TheAtomicOption opened this issue Feb 4, 2014 · 18 comments
Closed

DPS Graph window does not load #40

TheAtomicOption opened this issue Feb 4, 2014 · 18 comments

Comments

@TheAtomicOption
Copy link

Long standing issue for me. Neither selecting Graph from the menu nor Ctrl-G bring up the graphing window.

Using Windows 7
error_log.txt and output_log.txt are both empty.

Google search showed some people having issues with font caching and matplotlib, but deleting fontList.cache in the ~/.matplotlib/folder to force its reconstruction did not fix the issue.

Please advise if there's a way I can enable more logging to get better information on what's happening. Thanks.

@blitzmann
Copy link
Collaborator

Does anything happen? Pyfa crash? Or the window just not load?

@TheAtomicOption
Copy link
Author

Nothing happens. No crash. Pyfa continues to function normally. Window just doesn't load.

@DarkFenX
Copy link
Member

DarkFenX commented Feb 9, 2014

Try launching pyfa from console and see if it prints "Problems importing matplotlib; continuing without graphs" there when you open graph. If it does, i will explain how to get more detailed data on import crash.

@TheAtomicOption
Copy link
Author

Opened cmd and ran pyfa. Only output was a blank line before I got the prompt back (and the pyfa window).

Pyfa runs as before (no graphs). I'm assuming this means matplotlib is at least loading on app start? so I have that going for me which is nice.

@blitzmann
Copy link
Collaborator

Ran the exe from console? Is it possible to run it from source on python2? I also run Win7 and the latest version of Pyfa with no trouble with the DPS graph =(

@TheAtomicOption
Copy link
Author

Oh! ♿ Ok! Installed python, everything listed in the readme, and managed to get python running from source...

The first attempt to open a graph produces: "Problems importing matplotlib; continuing without graphs"

Further attempts to open a graph produce:

    Traceback (most recent call last):
      File "C:\Program Files (x86)\pyfa\.\gui\mainFrame.py", line 542, in openGraphFrame
        self.graphFrame.SetFocus()
      File "wx\_core.pyo", line 9301, in SetFocus

    TypeError: in method 'Window_SetFocus', expected argument 1 of type 'wxWindow *'

Note: (this was copied from the log file, see below, so the path is different than my copy of the source)

Also I noticed that error_log.txt and output_log.txt are not written until Pyfa is closed. So I tried running from the .exe again and after attempting to open a graph and then closing Pyfa these same errors are written to the logs.

@DarkFenX
Copy link
Member

Do you have any other alternative installations of wxwidgets / wxpython?

This error should never happen if bundled versions are used, to my understanding.

@TheAtomicOption
Copy link
Author

No. I've never installed them before just now to run pyfa from source, but of course the issue was present before that.

The bundled libraries are definitely present in the pyfa directory. I always unzip/copy+replace the entire pyfa directory when a new version comes out, so the version in the pyfa directory should be ok. Does pyfa not use those copies by default over libraries installed elsewhere?

What should be my next debug steps be?

@blitzmann
Copy link
Collaborator

Well, if it fails to import the module for wahtever reason, it seems to still set self.graphFrame to something. Then upon subsequent tries to open the window it fails because, well, it failed the first time and set self.graphFrame to an incorrect value. That should be fixed.

As to why it's not importing in the first place... I have no idea. I'll try to look into it further. Can you do me a favor though? I'm interested in seeing what exactly self.graphFrame is being set to after failing to import.

This is the block that's not working for you:

def openGraphFrame(self, event):
    if not self.graphFrame:
        self.graphFrame = GraphFrame(self)
        if gui.graphFrame.enabled:
            self.graphFrame.Show()
    else:
        self.graphFrame.SetFocus()

Since pyfa is setting self.graphFrame upon failutre, it is no longer None and thus will try to set focus to the non-existent window.

In the source files (not the bundled release), open gui/mainFrame.py and find that block (towards the bottom). Right under def openGraphFrame(self, event):, add print self.graphFrame making sure that the indentation is correct.

That will print the contents of self.graphFrame to the console. Then run from the console with python path/to/pyfa.py. Let pyfa load, and then try to open the graph window. What pops up in the console? Try to open the window again and see what it's being set to. Document your steps and let us know. =)

@TheAtomicOption
Copy link
Author

Ok updated mainFrame.py, new output on first attempt to graph

None
Problems importing matplotlib; continuing without graphs

as expected. Subsequent attempts to open the graph output:

<gui.graphFrame.GraphFrame;   >
Traceback (most recent call last):
    File "[irrelevant path]\Pyfa\gui\mainFrame.py", line 543, in open GraphFrame
       self.graphFrame.SetFocus()
    File "C:\Python27\lib\site-packages\wx2.8-msw-unicode\wx\_core.py", line 9304, in SetFocus
       return _core_.Window_SetFocus(*args, **kwards)
TypeError: in method 'Window_SetFocus', expected argument 1 of type 'wxWindow *'

so it looks like it's setting it to <gui.graphFrame.GraphFrame; >

Other things I thought about printing (like the exception code in graphFrame.py didn't turn out well because I don't know what I'm doing. 😄

@blitzmann
Copy link
Collaborator

Yeah, it's just setting it to the GraphFrame class. I figured as much. Lets try to print out the exception message. Right now it catches the exception, but just prints out "Problem importing yada yada"

In gui/graphFrame.py, find the block with that error message:

    except:
        print "Problems importing matplotlib; continuing without graphs"
        enabled = False
        return

Replace with:

    except Exception, e:
        print e.__doc__
        print e.message
        return

(again, make sure indentation is correct)

That will let us know what exactly is failing. If it's a failure to find the module, then I have no idea how to fix that as it should be bundled.

@TheAtomicOption
Copy link
Author

Ok! error is:

Import can't find module, or can't find name in module.
matplotlib requires dateutil
Traceback (most recent call last):
    File "[irrelevant path]\pyfa\gui\mainFrame.py", line 541, in openGraphFrame
        self.graphFrame.Show()
    File "C:\python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 9143, in Show
        return _core_.Window_Sohw(*args, **kargs)
TypeError: in method 'Window_Show', expected argument 1 of type 'wxWindow *'

looks like the traceback is from getting rid of enabled = False, so pyfa attempts to Show() the window despite not loading mathplotlib or finishing init

so I need dateutil?

As expected, attempting to open a graph the 2nd time produces the same error as before since we only run init at creation of an instance.

@blitzmann
Copy link
Collaborator

Yeah, it seems that, for whatever reason, dateutil isn't loading for you. Weird.

Go ahead and add enabled = False back to the exception catch block. Keep the code that prints exceptions because we want to see if it still has issues. Add import dateutil to the other imports at the top of gui/graphFrame.py and see if it works then

@TheAtomicOption
Copy link
Author

I tried adding it at both the top and bottom of the stack of imports before the GraphFrame class begins in graphFrame.py. This caused Pyfa to not start at all. I get Traceback and ImportError: No module named dateutil

I used the github app to download this source, so I should have everything. Should there be a dateutils.py somewhere?

@TheAtomicOption
Copy link
Author

Update: I found an installer for python-dateutils 2.2 for py2.7 and used it. Now I'm getting matplotlib requires pyparsing. I'll see if I can find that also. Still puzzling.

@TheAtomicOption
Copy link
Author

I just deleted my c:\program files (x86)\pyfa\ directory again and reinstalled using the exe. Graphs work. I've tried that before without success. Really puzzled, but I won't argue with victory.

Running pyfa from source still gives me the matplotlib requires pyparsing error, but if you don't want to keep debugging that I understand.

Either way, thanks very much for your time helping me through this!

@blitzmann
Copy link
Collaborator

wtf. Agree'd really weird.

The source pyfa runs off the python interpreter that you installed, whereas the bundled pyfa come with it's own python and all the python modules needed (which is why it was perplexing that it didn't work). They are separate, the interpreter that you installed requires you to manually install the dependencies.

Glad you got it working. Go ahead and close the issue please. o7

@DarkFenX
Copy link
Member

I think it has something to do with python using obsolete .pycs (happens sometimes, to my knowledge, although it compares src & pyc using timestamp so this is unlikely to happen).

Glad that you sorted this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants