devpy icon indicating copy to clipboard operation
devpy copied to clipboard

Fix devpy erros for working on windows

Open ados1991 opened this issue 8 years ago • 2 comments

C:\Users...\Desktop\doker\oscaro\env\Scripts\python.exe C:/Users/.../.../config/test/test.py

TypeError: mkdir() got an unexpected keyword argument 'exist_ok' cause from this redefined function for WindowsPath :

mkdir(mode=511, parents=False) method of pathlib.WindowsPath instance

Traceback (most recent call last): File "C:/Users/.../.../config/test/test.py", line 1, in import devpy.develop as log File "C:\Users...\Desktop\doker\oscaro\env\lib\site-packages\devpy\develop_init_.py", line 6, in sys.modules['devpy.develop'] = dev_mode() File "C:\Users...\Desktop\doker\oscaro\env\lib\site-packages\devpy_init_.py", line 14, in dev_mode return devpy.autolog() File "C:\Users...\Desktop\doker\oscaro\env\lib\site-packages\devpy\log.py", line 50, in autolog log_file = path or Path(temp_dir(name)) / "auto.log" File "C:\Users...\Desktop\doker\oscaro\env\lib\site-packages\devpy\temp.py", line 10, in temp_dir directory.mkdir(exist_ok=True) TypeError: mkdir() got an unexpected keyword argument 'exist_ok'

Process finished with exit code 1

TypeError: 'WindowsPath' does not support the buffer interface, pass str(WindowsPath instance) to RotatingFileHandler: file_handler = RotatingFileHandler(str(log_file), 'a', 1000000, 1)

C:\Users...\Desktop\doker\oscaro\env\Scripts\python.exe C:/Users/.../.../config/test/test.py

Traceback (most recent call last): File "C:/Users/.../.../config/test/test.py", line 1, in import devpy.develop as log File "C:\Users...\Desktop\doker\oscaro\env\lib\site-packages\devpy\develop_init_.py", line 6, in sys.modules['devpy.develop'] = dev_mode() File "C:\Users...\Desktop\doker\oscaro\env\lib\site-packages\devpy_init_.py", line 14, in dev_mode return devpy.autolog() File "C:\Users...\Desktop\doker\oscaro\env\lib\site-packages\devpy\log.py", line 55, in autolog file_handler = RotatingFileHandler(log_file, 'a', 1000000, 1) File "C:\Python34\Lib\logging\handlers.py", line 150, in init BaseRotatingHandler.init(self, filename, mode, encoding, delay) File "C:\Python34\Lib\logging\handlers.py", line 57, in init logging.FileHandler.init(self, filename, mode, encoding, delay) File "C:\Python34\Lib\logging_init_.py", line 996, in init self.baseFilename = os.path.abspath(filename) File "C:\Users...\Desktop\doker\oscaro\env\lib\ntpath.py", line 547, in abspath path = _getfullpathname(path) TypeError: 'WindowsPath' does not support the buffer interface

Process finished with exit code 1

ados1991 avatar Mar 28 '17 10:03 ados1991

That is not a problem from windows. It's a 3.5 compat problem.

sametmax avatar Mar 31 '17 05:03 sametmax

Maybe because me i'am working with python3.4, and also for windospath instance the method mkdir dont take the keyword parameter exist_ok this is why i add os.name = 'nt' in temp.py

ados1991 avatar Mar 31 '17 07:03 ados1991