TypeError when attempting to run top.py on macos

Issue #26 resolved
Adrian Bradd created an issue

Running macos 10.12 and Python 3.6.1 :: Anaconda 4.4.0 (x86_64). When running 'python top.py' I get a TypeError from os.path.isdir likely because of a malformed input. This occurs on both master and develop. Backtrace is below:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/Users/links_world/src/ycircuit/top.py in <module>()
     21     QtCore.QCoreApplication.setApplicationName('YCircuit')
     22     app = QtWidgets.QApplication(sys.argv)
---> 23     form = myMainWindow()
     24     form.showMaximized()
     25     form.ui.drawingArea.fitToViewRoutine()

/Users/links_world/src/ycircuit/src/mainwindow.py in __init__(self)
     11         super().__init__()
     12         self.ui = Ui_MainWindow()
---> 13         self.ui.setupUi(self)
     14         icon = QtGui.QIcon()
     15         icon.addPixmap(QtGui.QPixmap('./Resources/icon.jpg'))

/Users/links_world/src/ycircuit/src/gui/ycircuit_mainWindow.py in setupUi(self, MainWindow)
     20         self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
     21         self.horizontalLayout.setObjectName("horizontalLayout")
---> 22         self.drawingArea = DrawingArea(self.centralwidget)
     23         self.drawingArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
     24         self.drawingArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)

/Users/links_world/src/ycircuit/src/drawingarea.py in __init__(self, parent)
     63         self.settingsFileName = '.config'
     64         self.optionswindow = MyOptionsWindow(self, self.settingsFileName)
---> 65         self.applySettingsFromFile(self.settingsFileName)
     66
     67         self.items = []

/Users/links_world/src/ycircuit/src/drawingarea.py in applySettingsFromFile(self, fileName)
    135         # Create default directory if it does not exist
    136         print(self.defaultSchematicSaveFolder)
--> 137         if not os.path.isdir(self.defaultSchematicSaveFolder):
    138             os.mkdir(self.defaultSchematicSaveFolder)
    139         self.showSymbolPreview = settings.value('SaveExport/Symbol/Show preview', type=bool)

/Users/links_world/anaconda3/lib/python3.6/genericpath.py in isdir(s)
     40     """Return true if the pathname refers to an existing directory."""
     41     try:
---> 42         st = os.stat(s)
     43     except OSError:
     44         return False

TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

Comments (5)

  1. Siddharth Shekar repo owner

    This is likely because you'd run YCircuit there before and it had created a .config file for a previous version. As I add new keys to the .config file, I haven't yet implemented a way to use the existing ones and add the missing ones - it just crashes by default. Try deleting the .config file and running it again (you will lose your config settings though, if you'd rather not lose them, make a backup and copy over the values via a diff).

  2. Siddharth Shekar repo owner

    As of the latest update, this error should not show up at all. The program now assumes default values for missing entries unless they are explicitly changed from the options menu.

  3. Log in to comment