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

"play new" does not run #1493

Open
phaus opened this issue Aug 13, 2024 · 13 comments
Open

"play new" does not run #1493

phaus opened this issue Aug 13, 2024 · 13 comments

Comments

@phaus
Copy link

phaus commented Aug 13, 2024

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.

@jacol84
Copy link
Contributor

jacol84 commented Aug 14, 2024

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'

@phaus
Copy link
Author

phaus commented Aug 14, 2024

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?

@jacol84
Copy link
Contributor

jacol84 commented Aug 19, 2024

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

@phaus
Copy link
Author

phaus commented Aug 19, 2024

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.

@jacol84
Copy link
Contributor

jacol84 commented Aug 21, 2024

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

@phaus
Copy link
Author

phaus commented Aug 21, 2024

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

@jacol84
Copy link
Contributor

jacol84 commented Aug 21, 2024

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
Copy link
Contributor

jacol84 commented Aug 27, 2024

@phaus it is working?

@phaus
Copy link
Author

phaus commented Aug 29, 2024

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? 🤔

@jacol84
Copy link
Contributor

jacol84 commented Sep 2, 2024

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

@xael-fry
Copy link
Member

xael-fry commented Sep 8, 2024

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 ?

@phaus
Copy link
Author

phaus commented Sep 8, 2024

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
Copy link
Author

phaus commented Sep 8, 2024

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

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

3 participants