Solved

can't create directory in python mac os x

Posted on 2015-02-21
1
70 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
For Loop in Python - Logic Question 6 86
Merging two data frames and doing calculation 5 56
looping 11 34
How does this Python sort work? 5 65
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…
Sequence is something that used to store data in it in very simple words. Let us just create a list first. To create a list first of all we need to give a name to our list which I have taken as “COURSE” followed by equals sign and finally enclosed …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now