def openFile(self):
""" Module for importing in .txt anim files """
fileFilters = "Text (*.txt)"
fileList = cmds.fileDialog2(fileMode = 1, fileFilter = fileFilters, dialogStyle = 2)
if fileList:
stringConvert = ''.join(fileList)
print "Imported File is opened from : %s" %stringConvert
self.importTxt.setText(stringConvert)
PySide.QtCore.QEvent.Type.ChildPolished
QFileDialog
PySide.QtCore.QEvent.Type.ChildPolished
QFileDialog
PySide.QtCore.QEvent.Type.ChildRemoved
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/2b7c93eb-c9bb-4072-86a8-0d6703cda807%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import maya.cmds as cmds
from PyQt4.QtCore import *
from PyQt4.QtGui import *
def initUI(self):
self.openAnimBtn = QToolButton()
gridLayout = QGridLayout()
gridLayout.addWidget(self.openAnimBtn, 1, 2, 1, 1)
self.setLayout(gridLayout)
def createConnections(self):
self.connect(self.openAnimBtn, SIGNAL('clicked()'), self.openFile)
def openFile(self):This will append line number and filename to each print statement, maybe it can help you figure out where it’s coming from.
https://gist.github.com/mottosso/7261394e511bc6206ede
(Though I’m having trouble figuring out why it repeats the appended information, I expected flushing to handle it, but it did not)
Hi,
Sorry for the late reply, totally missed this!
To run it, I’ll need to give you a little backstory. Whenever you use print "something", you are essentially calling sys.stdout.write("something" + "\n") which means “write to standard out with a new-line”, where “standard out” generally refers to a terminal.
By replacing sys.stdout with the object above, print will instead refer to that class when attempting to write to “standard out”, which will in this case append some additional information before doing so.
The sys.__stdout__ is an extra variable kept per default by Python and refers to the original sys.stdout, in case you overwrite it like we are here. We use it to refer back to where printing would happen normally; which again is generally the terminal. But this time, it will have that extra piece of information coming along with it.
My intent was for you to replace sys.stdout before running any other code, so as to make the rest of your code print its information with line-numbers, so that you could locate exactly where those printed lines where coming from; assuming that it is print statements which was causing them.
Does that help?
Best,
Marcus
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/3f5f5c0e-1ca0-40d0-a4a8-5e25c6c9b0b6%40googlegroups.com.