Xlsxwriter has vanished

Good morning,

One of my TK-Apps is failing this morning because it can no longer import the xlsxwriter Python module from the Toolkit installation.

Was it removed recently?

File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/app_store/tk-shotgun-exportnotes/v0.9.0/python/tk_shotugn_exportnotes/export_notes.py”, line 15, in
import xlsxwriter
ImportError: No module named xlsxwriter

Can I add it back some how, somewhere?

Daniel

Hey Daniel!

I’m not familiar with tk-shotgun-exportnotes, so I’m not sure if the typo I’m seeing is in your code or showed up when you were transcribing the error message, but there’s a typo in the path:

tk_shotugn_exportnotes should be tk_shotgun_exportnotes

Might that be the issue?

File “/Volumes/Droid/PIPE/Shotgun/PipelineConfigurations/PIPE/Toolkit/install/app_store/tk-shotgun-exportnotes/v0.9.0/python/tk_shotgun_exportnotes/export_notes.py”, line 15, in
import xlsxwriter
ImportError: No module named xlsxwriter

Nope. That was just a typo that was not causing any issues. Just unclean…

Ill dig in further. It just started throwing this error this morning, out of the blue…

It seems that I can import it from the Python Console just fine…

Daniel

I commented out that import line and it launches again but now my app looks very different. Looks like the ‘stylesheets’ have changed?

Curious. Did anything change last night?

darn.

I’d be curious to know if the relevant config/core/interpreter_<OS>.cfg file has changed. And if you can successfully import the module from the Python specified there.

What version of tk-core are you using? Has it changed recently?

It would be helpful to get the full stack trace, too.

And just so I understand, this is custom code in which you were relying on xlsxwriter being bundled in the Python that’s running it? Could you use sys.path.append() to point to a path where that module lives?

Looking into what may have changed overnight; will report back on what I find.

Rebooted workstation and things are back normal. I have no idea what happened. But things are back.

On a related note.

This app was converted from a AMI plugin. In that plugin I was able to modify the text color using commands like…

red_text = QtGui.QPalette()
red_text.setColor(QtGui.QPalette.Foreground,QtCore.Qt.red)
self.wba_title_message.setPalette(red_text)

This does not seem to work in the TK_Apps. Do I need to setStyleSheet() instead?

The reason I ask is that when things were acting ‘odd’ this morning, all my text colors were showing back up again (like when it was an AMI plugin). Also all of the fonts were different. It was like it was missing the TK ‘StyleSheet’ and everything reverted back to plain-Jane PySide.

Anywho. Thats a separate ticket.

Back to work.

2 Likes

Hey Daniel! The Toolkit apps do use a dark palette, but we recommend making changes (like text color) either via html tags or styleSheet. In general, if you’re always setting a certain element to the same color, styleSheet is the way to go; if you’ve got different colors within an element, or need to set the color of some text on the fly, html tags are a good solution. Here’s an example from our own code where we use html tags to set font color. Hope that helps!

3 Likes