Solved

can't create directory in python mac os x

Posted on 2015-02-21
1
68 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The really strange introduction Once upon a time there were individuals who intentionally put the grass seeds to the soil with anticipation of solving their nutrition problems. Or they maybe only played with seeds and noticed what happened... Som…
Dictionaries contain key:value pairs. Which means a collection of tuples with an attribute name and an assigned value to it. The semicolon present in between each key and values and attribute with values are delimited with a comma.  In python we can…
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 modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

708 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

16 Experts available now in Live!

Get 1:1 Help Now