play1 icon indicating copy to clipboard operation
play1 copied to clipboard

"play new" does not run

Open phaus opened this issue 1 year ago • 13 comments

Play Version

1.7.1 1.8.0

Describe the bug play new should create a new application. Instead the following error is displayed:

(base) philipp@Imotep /tmp % play new app1
~        _            _
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/
~
~ play! 1.8.0, https://www.playframework.com
~
~ The new application will be created in /private/tmp/app1
~ What is the application name? [app1]
Traceback (most recent call last):
  File "/Users/philipp/.bin/play/play", line 168, in <module>
    status = cmdloader.commands[play_command].execute(command=play_command, app=play_app, args=remaining_args, env=play_env, cmdloader=cmdloader)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/philipp/.bin/play/framework/pym/play/commands/base.py", line 38, in execute
    new(app, args, env, cmdloader)
  File "/Users/philipp/.bin/play/framework/pym/play/commands/base.py", line 95, in new
    os.mkdir(os.path.join(app.path, 'app/models'))
FileNotFoundError: [Errno 2] No such file or directory: '/private/tmp/app1/app/models'

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

or

Please provide a PR with a failing test.

If the issue is more complex or requires configuration, please provide a link to a project on Github that reproduces the issue.

Expected behavior The app is created

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Darwin Imotep.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64
  • Browser -
  • Version -
  • JDK: OpenJDK Runtime Environment Temurin-17.0.12+7 (build 17.0.12+7)
  • Python: Python 3.12.3

Additional context Add any other context about the problem here.

phaus avatar Aug 13 '24 21:08 phaus

image it works for me

I would bet on permissions because it didn't create a folder for you FileNotFoundError: [Errno 2] No such file or directory: '/private/tmp/app1/app/models'

jacol84 avatar Aug 14 '24 06:08 jacol84

Hi @jacol84 - thx for the response…

I did another test, in my home directory… see the permissions, the same result.

% ls -al
total 0
drwxr-xr-x  2 philipp  staff   64 14 Aug 08:23 .
drwxr-xr-x  6 philipp  staff  192 14 Aug 08:23 ..
(base) philipp@Imotep play-app % play new foo1
~        _            _
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/
~
~ play! 1.8.0, https://www.playframework.com
~
~ The new application will be created in /Users/philipp/tmp/play-app/foo1
~ What is the application name? [foo1]
Traceback (most recent call last):
  File "/Users/philipp/.bin/play/play", line 168, in <module>
    status = cmdloader.commands[play_command].execute(command=play_command, app=play_app, args=remaining_args, env=play_env, cmdloader=cmdloader)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/philipp/.bin/play/framework/pym/play/commands/base.py", line 38, in execute
    new(app, args, env, cmdloader)
  File "/Users/philipp/.bin/play/framework/pym/play/commands/base.py", line 95, in new
    os.mkdir(os.path.join(app.path, 'app/models'))
FileNotFoundError: [Errno 2] No such file or directory: '/Users/philipp/tmp/play-app/foo1/app/models'

Any idea, where I can start to have a look why this does not work?

phaus avatar Aug 14 '24 06:08 phaus

@phaus Hey after the script play new foo1 do ls -al -R

jacol84 avatar Aug 19 '24 06:08 jacol84

To me it looks like something is just not created:

(base) philipp@Imotep play-test % play new foo1
~        _            _
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/
~
~ play! 1.8.0, https://www.playframework.com
~
~ The new application will be created in /private/tmp/play-test/foo1
~ What is the application name? [foo1]
Traceback (most recent call last):
  File "/Users/philipp/.bin/play/play", line 168, in <module>
    status = cmdloader.commands[play_command].execute(command=play_command, app=play_app, args=remaining_args, env=play_env, cmdloader=cmdloader)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/philipp/.bin/play/framework/pym/play/commands/base.py", line 38, in execute
    new(app, args, env, cmdloader)
  File "/Users/philipp/.bin/play/framework/pym/play/commands/base.py", line 95, in new
    os.mkdir(os.path.join(app.path, 'app/models'))
FileNotFoundError: [Errno 2] No such file or directory: '/private/tmp/play-test/foo1/app/models'
(base) philipp@Imotep play-test % ls -al -R
total 0
drwxr-xr-x   3 philipp  wheel   96 19 Aug 08:24 .
drwxrwxrwt  10 root     wheel  320 19 Aug 08:24 ..
drwxr-xr-x   2 philipp  wheel   64 19 Aug 08:24 foo1

./foo1:
total 0
drwxr-xr-x  2 philipp  wheel  64 19 Aug 08:24 .
drwxr-xr-x  3 philipp  wheel  96 19 Aug 08:24 ..

play run works fine with existing projects.

phaus avatar Aug 19 '24 06:08 phaus

how could you change in Users/philipp/.bin/play/framework/pym/play/commands/base.py line 95 of the code os.mkdir(os.path.join(app.path, 'app/models')) and add above it os.mkdir(os.path.join(app.path, 'app'))

image

jacol84 avatar Aug 21 '24 12:08 jacol84

Thx. So I did not got the error. However, the generated app does not seem to be complete:

(base) philipp@Imotep /tmp % play new foo
~        _            _
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/
~
~ play! 1.8.0, https://www.playframework.com
~
~ The new application will be created in /private/tmp/foo
~ What is the application name? [foo]
~ Oops. conf/routes or conf/application.conf missing.
~ /private/tmp/foo does not seem to host a valid application.
~
(base) philipp@Imotep /tmp % tree -L 4 foo
foo
├── app
│   └── models
└── lib

4 directories, 0 files

phaus avatar Aug 21 '24 12:08 phaus

maybe you need to create all folders

├───app │ ├───controllers │ ├───models │ └───views │ ├───Application │ └───errors ├───conf ├───documentation │ ├───files │ └───images ├───lib ├───modules ├───public │ ├───images │ ├───javascripts │ └───stylesheets └───test

image

    os.mkdir(os.path.join(app.path, 'app'))
    os.mkdir(os.path.join(app.path, 'app/controllers'))
    os.mkdir(os.path.join(app.path, 'app/models'))
    os.mkdir(os.path.join(app.path, 'app/views'))
    os.mkdir(os.path.join(app.path, 'app/views/Application'))
    os.mkdir(os.path.join(app.path, 'app/views/errors'))
    os.mkdir(os.path.join(app.path, 'conf'))
    os.mkdir(os.path.join(app.path, 'documentation'))
    os.mkdir(os.path.join(app.path, 'documentation/files'))
    os.mkdir(os.path.join(app.path, 'documentation/images'))
    os.mkdir(os.path.join(app.path, 'modules'))
    os.mkdir(os.path.join(app.path, 'public'))
    os.mkdir(os.path.join(app.path, 'public/images'))
    os.mkdir(os.path.join(app.path, 'public/javascripts'))
    os.mkdir(os.path.join(app.path, 'public/stylesheets'))
    os.mkdir(os.path.join(app.path, 'test'))
    os.mkdir(os.path.join(app.path, 'lib'))

jacol84 avatar Aug 21 '24 12:08 jacol84

@phaus it is working?

jacol84 avatar Aug 27 '24 10:08 jacol84

Hi @jacol84 I don't really get it. Until play 1.4.x, the play new cmd did generate the whole folder strucutre. So were there some changes there?

With your changes, the folder structure is there, but now config files (aka application.conf or dependencies.yml). To me, it looks like the application skeleton is not used at all to setup a new app? 🤔

phaus avatar Aug 29 '24 08:08 phaus

there have been changes system python is used and not the version of play that was provided as before (play 1.4 with python 2.x) (play 1.5+ is without python) now python is required in version 3

update your python version to the latest one, maybe that will help

jacol84 avatar Sep 02 '24 12:09 jacol84

the copy_directory doesn't seems to work, could you tell me if /Users/philipp/.bin/play/resources/application-skel exist and what is the content of this directory ?

xael-fry avatar Sep 08 '24 14:09 xael-fry

Sure… I am a little bit covered in work right now. If I can test anything, I will be able to do that end of this week. Please see content of /Users/philipp/.bin/play/resources/application-skel:

philipp@MacLab resources % tree -L 3
.
├── _nbproject
│   └── project.xml
├── application-build.xml
├── application-skel
│   ├── app
│   │   ├── controllers
│   │   └── views
│   ├── conf
│   │   ├── application.conf
│   │   ├── dependencies.yml
│   │   ├── messages
│   │   └── routes
│   ├── documentation
│   │   ├── files
│   │   ├── images
│   │   ├── template.html
│   │   └── welcome.textile
│   ├── public
│   │   ├── images
│   │   ├── javascripts
│   │   └── stylesheets
│   └── test
│       ├── Application.test.html
│       ├── ApplicationTest.java
│       ├── BasicTest.java
│       └── data.yml
├── build.xml
├── eclipse
│   ├── connect.launch
│   ├── debug.launch
│   └── test.launch
├── idea
│   ├── imlTemplate.xml
│   └── iprTemplate.xml
├── messages
├── module-skel
│   ├── build.xml
│   ├── commands.py
│   ├── conf
│   │   ├── dependencies.yml
│   │   ├── messages
│   │   └── routes
│   ├── documentation
│   │   └── manual
│   └── src
│       └── play.plugins
└── war
    └── web.xml

phaus avatar Sep 08 '24 15:09 phaus

I am using a link to the recent play version (what worked in the past) Like this:

philipp@MacLab ~ % ls -al ~/.bin  |grep play
lrwxr-xr-x@   1 philipp  staff        10 21 Aug 14:26 play -> play-1.8.0
drwxr-xr-x@  14 philipp  staff       448  1 Mär  2024 play-1.8.0

Maybe that is causing some issues?

PLAY_HOME is set correctly to PLAY_HOME=/Users/philipp/.bin/play-1.8.0

phaus avatar Sep 08 '24 15:09 phaus