Solved

can't create directory in python mac os x

Posted on 2015-02-21
1
73 Views
Last Modified: 2015-03-12
I'm trying to set up a test , but this does not seem to create a directory ('m new to python)
import unittest
import glob
import os

PATH = "extentest"

class FileHandling(unittest.TestCase):

	def setUp(self):
		self.path = PATH
		self.file_names = ["file.ext123", "file.ext123", "file.ext123",
			"file.ext123", "file.ext123", "file.ext223","file.ext223"]
		os.mkdir(self.path)
		for fn in self.file_names:
			f = open(self.path+fn, "w")
			f.close()
	
if __name__ == "__main__":
    unittest.main()

Open in new window

0
Comment
Question by:sniger
1 Comment
 
LVL 25

Accepted Solution

by:
clockwatcher earned 500 total points
ID: 40624480
The setUp method is run before each test and your class doesn't have any tests.  Without a test, I can't imagine it would be run.  Try adding a test.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Less strange, but still introduction This introduction was added (1st August, 2011) to reflect some reactions.  Firstly, the term basics in the title of the article...  As any other word, it is a symbol with meaning attached to the word by some a…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question