Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue during creation of testproj files #4

Open
austinkeller opened this issue Sep 9, 2016 · 4 comments
Open

Issue during creation of testproj files #4

austinkeller opened this issue Sep 9, 2016 · 4 comments

Comments

@austinkeller
Copy link

austinkeller commented Sep 9, 2016

Here is the error observed in python 2:

c:\proj\deleteme2>python --version
Python 2.7.12 :: Anaconda 4.1.1 (64-bit)

c:\proj\deleteme2>python-boilerplate --version
python-boilerplate 0.4.1

c:\proj\deleteme2>python-boilerplate init
Project's name: testproj
Author's name: Austin Keller
Author's email: [email protected]
Python name:  [testproj]
Version:  [0.1.0]
License:  [gpl] apache
Has scripts?  [Y/n]

Your config file was saved as boilerplate.ini. Leave blank to continue or specify a text editor.
Editor:
    creating c:\proj\deleteme2\VERSION...
    creating c:\proj\deleteme2\.gitignore...
    creating c:\proj\deleteme2\README.rst...
    creating c:\proj\deleteme2\INSTALL.rst...
    creating c:\proj\deleteme2\LICENSE...
    creating c:\proj\deleteme2\tasks.py...
    creating c:\proj\deleteme2\setup.py...
    creating c:\proj\deleteme2\MANIFEST.in...
    creating c:\proj\deleteme2\requirements.txt...
    creating c:\proj\deleteme2\src\testproj\__init__.py...
Traceback (most recent call last):
  File "c:\users\austin\anaconda2\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\users\austin\anaconda2\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Users\Austin\Anaconda2\Scripts\python-boilerplate.exe\__main__.py", line 9, in <module>
  File "c:\users\austin\anaconda2\lib\site-packages\python_boilerplate\__main__.py", line 11, in main
    func(args)
  File "c:\users\austin\anaconda2\lib\site-packages\python_boilerplate\commands\parser.py", line 41, in handler
    func(**kwargs)
  File "c:\users\austin\anaconda2\lib\site-packages\python_boilerplate\commands\parser.py", line 32, in handler
    writer.run()
  File "c:\users\austin\anaconda2\lib\site-packages\python_boilerplate\commands\init.py", line 104, in run
    '%s/__init__.py' % basedir, ignore=True)
  File "c:\users\austin\anaconda2\lib\site-packages\python_boilerplate\core.py", line 137, in write
    hash = write_template(template, context, ignore=ignore, path=path)
  File "c:\users\austin\anaconda2\lib\site-packages\python_boilerplate\jinja.py", line 57, in write_template
    with open(path, 'w') as F:
IOError: [Errno 2] No such file or directory: u'src/testproj/__init__.py'

and here is the error observed in python 3 (after manually adding PEP encoding specifier to __meta__.py file, see #3 )

(py3) c:\proj\deleteme>python --version
Python 3.5.2 :: Continuum Analytics, Inc.

(py3) c:\proj\deleteme>python-boilerplate --version
python-boilerplate 0.4.1

(py3) c:\proj\deleteme>python-boilerplate init
Project's name: testproj
Author's name: Austin Keller
Author's email: [email protected]
Python name:  [testproj]
Version:  [0.1.0]
License:  [gpl]
Has scripts?  [Y/n]

Your config file was saved as boilerplate.ini. Leave blank to continue or specify a text editor.
Editor:
    creating c:\proj\deleteme\VERSION...
    creating c:\proj\deleteme\.gitignore...
    creating c:\proj\deleteme\README.rst...
    creating c:\proj\deleteme\INSTALL.rst...
    creating c:\proj\deleteme\LICENSE...
    creating c:\proj\deleteme\tasks.py...
    creating c:\proj\deleteme\setup.py...
    creating c:\proj\deleteme\MANIFEST.in...
    creating c:\proj\deleteme\requirements.txt...
    creating c:\proj\deleteme\src\testproj\__init__.py...
Traceback (most recent call last):
  File "c:\users\austin\anaconda2\envs\py3\lib\runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\austin\anaconda2\envs\py3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Austin\Anaconda2\envs\py3\Scripts\python-boilerplate.exe\__main__.py", line 9, in <module>
  File "c:\users\austin\anaconda2\envs\py3\lib\site-packages\python_boilerplate\__main__.py", line 11, in main
    func(args)
  File "c:\users\austin\anaconda2\envs\py3\lib\site-packages\python_boilerplate\commands\parser.py", line 41, in handler
    func(**kwargs)
  File "c:\users\austin\anaconda2\envs\py3\lib\site-packages\python_boilerplate\commands\parser.py", line 32, in handler
    writer.run()
  File "c:\users\austin\anaconda2\envs\py3\lib\site-packages\python_boilerplate\commands\init.py", line 104, in run
    '%s/__init__.py' % basedir, ignore=True)
  File "c:\users\austin\anaconda2\envs\py3\lib\site-packages\python_boilerplate\core.py", line 137, in write
    hash = write_template(template, context, ignore=ignore, path=path)
  File "c:\users\austin\anaconda2\envs\py3\lib\site-packages\python_boilerplate\jinja.py", line 57, in write_template
    with open(path, 'w') as F:
FileNotFoundError: [Errno 2] No such file or directory: 'src/testproj/__init__.py'
fabiommendes added a commit that referenced this issue Sep 13, 2016
@fabiommendes
Copy link
Owner

Hi, sorry for the delay, busy here...

I think this is a windows-specific bug (I'm assuming that paths are separated by '/'). I fixed the first culprit, but I don' t have a windows machine to test it. Can you confirm if the bug is gone?

@austinkeller
Copy link
Author

It seems like using \\ in place of / still isn't behaving right:

(py3) c:\proj\deleteme2>python-boilerplate init
Project's name: test
Author's name: tester
Author's email: [email protected]
Python name:  [test]

Your config file was saved as boilerplate.ini. Leave blank to continue or specify a text editor.
Editor:
    creating c:\proj\deleteme2\VERSION...
    creating c:\proj\deleteme2\.gitignore...
    creating c:\proj\deleteme2\README.rst...
    creating c:\proj\deleteme2\INSTALL.rst...
    creating c:\proj\deleteme2\LICENSE...
    creating c:\proj\deleteme2\tasks.py...
    creating c:\proj\deleteme2\setup.py...
    creating c:\proj\deleteme2\MANIFEST.in...
    creating c:\proj\deleteme2\requirements.txt...
    creating c:\proj\deleteme2\src\test\__init__.py...
Traceback (most recent call last):
  File "c:\users\austin\anaconda2\envs\py3\lib\runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\austin\anaconda2\envs\py3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Austin\Anaconda2\envs\py3\Scripts\python-boilerplate.exe\__main__.py", line 9, in <module>
  File "c:\users\austin\anaconda2\envs\py3\lib\site-packages\python_boilerplate\__main__.py", line 11, in main
    func(args)
  File "c:\users\austin\anaconda2\envs\py3\lib\site-packages\python_boilerplate\commands\parser.py", line 41, in handler
    func(**kwargs)
  File "c:\users\austin\anaconda2\envs\py3\lib\site-packages\python_boilerplate\commands\parser.py", line 32, in handler
    writer.run()
  File "c:\users\austin\anaconda2\envs\py3\lib\site-packages\python_boilerplate\commands\init.py", line 109, in run
    '%s/__init__.py' % basedir, ignore=True)
  File "c:\users\austin\anaconda2\envs\py3\lib\site-packages\python_boilerplate\core.py", line 136, in write
    hash = write_template(template, context, ignore=ignore, path=path)
  File "c:\users\austin\anaconda2\envs\py3\lib\site-packages\python_boilerplate\jinja.py", line 61, in write_template
    with open(path, 'w') as F:
FileNotFoundError: [Errno 2] No such file or directory: 'src\\test\\__init__.py'

@austinkeller
Copy link
Author

I'll try getting a debugger for this running on my Windows machine to get some more helpful information

@fabiommendes
Copy link
Owner

It is using abspath in the hope that it works on windows now.
I hope it finally works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants