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

Incomplete deletion of old project not correctly idenfied #394

Closed
freakboy3742 opened this issue May 10, 2020 · 19 comments
Closed

Incomplete deletion of old project not correctly idenfied #394

freakboy3742 opened this issue May 10, 2020 · 19 comments
Labels
bug A crash or error in behavior. good first issue Is this your first time contributing? This could be a good place to start!

Comments

@freakboy3742
Copy link
Member

Originally reported as a side effect of #300

If you have previously run briefcase create for a given app, you'll be warned, and prompted to delete the old app:

(beeware-venv) lov080@DARKZERO-LN helloworld % briefcase create iOS            

Application helloworld already exists; overwrite (y/N)? y

Briefcase currently assumes that the app deletion is complete.

However, if something prevents the app from being deleted (e.g., an open terminal session, or the app being currently open, you will get an error:

[helloworld] Removing old application bundle...
Traceback (most recent call last):
  File "/Users/lov080/Google Drive/Python/BeeWare/examples/beeware-tutorial/beeware-venv/bin/briefcase", line 12, in <module>
    sys.exit(main())
  File "/Users/lov080/Google Drive/Python/BeeWare/examples/beeware-tutorial/beeware-venv/lib/python3.8/site-packages/briefcase/__main__.py", line 11, in main
    command(**options)
  File "/Users/lov080/Google Drive/Python/BeeWare/examples/beeware-tutorial/beeware-venv/lib/python3.8/site-packages/briefcase/commands/create.py", line 610, in __call__
    state = self.create_app(app, **full_kwargs(state, kwargs))
  File "/Users/lov080/Google Drive/Python/BeeWare/examples/beeware-tutorial/beeware-venv/lib/python3.8/site-packages/briefcase/commands/create.py", line 564, in create_app
    self.shutil.rmtree(str(bundle_path))
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 730, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 612, in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 610, in _rmtree_unsafe
    os.rmdir(path)
OSError: [Errno 66] Directory not empty: '/Users/lov080/Google Drive/Python/BeeWare/examples/beeware-tutorial/helloworld/iOS/Hello World'

but the create command will continue, resulting in a state where the app hasn't been recreated.

This edge case needs to be caught and corrected - we should check that the deletion completed without error before creating the new app.

@freakboy3742 freakboy3742 added bug A crash or error in behavior. up-for-grabs good first issue Is this your first time contributing? This could be a good place to start! labels May 10, 2020
@rajat641
Copy link

Hi @freakboy3742 - Can I work on this. I'm new to open source and I would be a great way for me to get involved.

@freakboy3742
Copy link
Member Author

@rajat641 Absolutely! If you have any questions, or need any pointers, let us know!

@nihit97natu
Copy link

Hi @freakboy3742. I am new to open source. I briefly went through the beeware tutorial on briefcase. Can you provide some additional details like the code files to refer or prerequisites that might be required for this task?

@freakboy3742
Copy link
Member Author

@nihit97natu Step one in any debugging task is to reproduce the problem. Use the details we have (listed in the ticket) to see if you can cause the same problem to occur on your own setup.

Step two is to encode that mode of failure as a failing test case. Write an automated test (or tests) that represent the problem. This test will fail on the current codebase.

Step three: make the test pass.

In this case, the problem code will almost certainly be in the implementation of the create command (src/briefcase/create.py); but you shouldn't start looking at the code until you can reproduce the problem.

@pratheekcr
Copy link

Hi, I am new to open source. Can I contribute to this, please?

@freakboy3742
Copy link
Member Author

Absolutely! We don't a strong formal process for "taking" a ticket - just drop a comment on the ticket you're planning to work on, and submit a PR; as long as it looks like you're making active progress on the issue, we'll discourage anyone else from working on the same ticket.

@pratheekcr
Copy link

Thanks @freakboy3742 Is there a chatroom for any open questions?

@freakboy3742
Copy link
Member Author

@pratheekcr Yes: https://gitter.im/beeware/general is our chat room.

@proneon267
Copy link
Contributor

Hello
Is this bug only reproducible on macos, as I cannot reproduce it on linux or windows.

@freakboy3742
Copy link
Member Author

@proneon267 It's possible this may be macOS specific. I know that having a terminal session open in Linux won't prevent a directory being deleted. I'm not sure if there might be other conditions that could prevent a directory from being deleted (other than a direct permissions change, which shouldn't happen in the case of Briefcase, but could happen if someone gets creative in their build folder). I don't have enough experience with Windows to say for certain if the same problem could exist.

@mhsmith
Copy link
Member

mhsmith commented Mar 27, 2023

It's probably most likely to happen on Windows, where you can't delete a file which a process has open. The Android Gradle daemon has a tendency to cause this situation.

But if the original bug of ignoring the exception still exists, you should be able to reproduce it on any platform with any target, simply by changing one of the build subdirectories to be non-writable.

@proneon267
Copy link
Contributor

proneon267 commented Mar 27, 2023

On linux, if a user without having access to the folder tries to run the command then it correctly raises permission denied error and not folder not empty error. I am not sure if I can reproduce it on linux.
For windows, I'll write an isolated case to reproduce the error and report back.

@mhsmith
Copy link
Member

mhsmith commented Mar 27, 2023

The original bug wasn't about how the exception is reported, but that "but the create command will continue". The command should not continue.

@proneon267
Copy link
Contributor

Yes, it doesn't continue after the permission denied error is raised

@mhsmith
Copy link
Member

mhsmith commented Mar 27, 2023

OK, if you can post some logs (generated by briefcase --log) proving that the behavior is now correct on Linux and Windows, then someone else can check on macOS and we can close this issue.

@proneon267
Copy link
Contributor

Sure, I'll post the logs after writing and testing the isolated cases.

@katefike
Copy link

katefike commented May 20, 2024

I tried to re-create the issue where the create command continues, even after encountering an error. I'm running Linux Ubuntu 22.04. I didn't encounter abnormal behavior: the issue is fixed on Linux. Can someone test on on Windows or Mac?

Replication Steps

  1. Create a new project: briefcase create
  2. Change the permissions of a directory: beeware-tutorial/helloworld/build/helloworld/pop/jammy$ chmod a-w ./
  3. Re-run briefcase create:

[helloworld] Finalizing application configuration...
Targeting pop:jammy (Vendor base debian)
Determining glibc version... done
Targeting glibc 2.35
Targeting Python3.10

Application 'helloworld' already exists; overwrite [y/N]? y

[helloworld] Removing old application bundle...

Log saved to /home/kfike/Projects/beeware-tutorial/helloworld/logs/briefcase.2024_05_20-15_40_16.create.log

Traceback (most recent call last):
  File "/home/kfike/Projects/beeware-tutorial/.venv/bin/briefcase", line 8, in <module>
    sys.exit(main())
  File "/home/kfike/Projects/beeware-tutorial/.venv/lib/python3.10/site-packages/briefcase/__main__.py", line 29, in main
    command(**options)
  File "/home/kfike/Projects/beeware-tutorial/.venv/lib/python3.10/site-packages/briefcase/commands/create.py", line 821, in __call__
    state = self.create_app(app, **full_options(state, options))
  File "/home/kfike/Projects/beeware-tutorial/.venv/lib/python3.10/site-packages/briefcase/commands/create.py", line 765, in create_app
    self.tools.shutil.rmtree(bundle_path)
  File "/usr/lib/python3.10/shutil.py", line 724, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.10/shutil.py", line 663, in _rmtree_safe_fd
    onerror(os.rmdir, fullname, sys.exc_info())
  File "/usr/lib/python3.10/shutil.py", line 661, in _rmtree_safe_fd
    os.rmdir(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'helloworld-0.0.1'

It appears that the re-create command did not continue after the error.

Briefcase Logs

Briefcase Log:
[15:40:14]                                                                                                                                                             system.py:133
           [helloworld] Finalizing application configuration...                                                                                                        system.py:133
           Targeting pop:jammy (Vendor base debian)                                                                                                                    system.py:143
           Determining glibc version... started                                                                                                                        system.py:201
           Determining glibc version... done                                                                                                                           system.py:201
           Targeting glibc 2.35                                                                                                                                        system.py:203
           Targeting Python3.10                                                                                                                                        system.py:207
                                                                                                                                                                       create.py:755
[15:40:16] Application 'helloworld' already exists; overwrite [y/N]?                                                                                                  console.py:705
           User input: y                                                                                                                                              console.py:705
                                                                                                                                                                       create.py:764
           [helloworld] Removing old application bundle...                                                                                                             create.py:764
           Saving log... started                                                                                                                                      console.py:390

Main thread traceback:
╭─────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────────╮
│ /home/kfike/Projects/beeware-tutorial/.venv/lib/python3.10/site-packages/briefcase/__main__.py:29 in main                                                                        │
│                                                                                                                                                                                  │
│   26 │   │   │   Path.cwd() / "pyproject.toml",                                                                                                                                  │
│   27 │   │   │   overrides=overrides,                                                                                                                                            │
│   28 │   │   )                                                                                                                                                                   │
│ ❱ 29 │   │   command(**options)                                                                                                                                                  │
│   30 │   except HelpText as e:                                                                                                                                                   │
│   31 │   │   logger.info()                                                                                                                                                       │
│   32 │   │   logger.info(str(e))                                                                                                                                                 │
│                                                                                                                                                                                  │
│ ╭─────────────────────────────────────────────── locals ───────────────────────────────────────────────╮                                                                         │
│ │       command = <briefcase.platforms.linux.system.LinuxSystemCreateCommand object at 0x79626a9e6ef0> │                                                                         │
│ │       Command = <class 'briefcase.platforms.linux.system.LinuxSystemCreateCommand'>                  │                                                                         │
│ │       console = <briefcase.console.Console object at 0x79626a9e6e30>                                 │                                                                         │
│ │ extra_cmdline = []                                                                                   │                                                                         │
│ │        logger = <briefcase.console.Log object at 0x79626a9e6e90>                                     │                                                                         │
│ │       options = {}                                                                                   │                                                                         │
│ │     overrides = {}                                                                                   │                                                                         │
│ │       printer = <briefcase.console.Printer object at 0x79626beafee0>                                 │                                                                         │
│ │        result = 0                                                                                    │                                                                         │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                         │
│                                                                                                                                                                                  │
│ /home/kfike/Projects/beeware-tutorial/.venv/lib/python3.10/site-packages/briefcase/commands/create.py:821 in __call__                                                            │
│                                                                                                                                                                                  │
│   818 │   │   else:                                                                                                                                                              │
│   819 │   │   │   state = None                                                                                                                                                   │
│   820 │   │   │   for app_name, app in sorted(self.apps.items()):                                                                                                                │
│ ❱ 821 │   │   │   │   state = self.create_app(app, **full_options(state, options))                                                                                               │
│   822 │   │                                                                                                                                                                      │
│   823 │   │   return state                                                                                                                                                       │
│   824                                                                                                                                                                            │
│                                                                                                                                                                                  │
│ ╭──────────────────────────────────────────── locals ─────────────────────────────────────────────╮                                                                              │
│ │      app = <sagefinancial.dev.helloworld v0.0.1 AppConfig>                                      │                                                                              │
│ │ app_name = 'helloworld'                                                                         │                                                                              │
│ │  options = {}                                                                                   │                                                                              │
│ │     self = <briefcase.platforms.linux.system.LinuxSystemCreateCommand object at 0x79626a9e6ef0> │                                                                              │
│ │    state = None                                                                                 │                                                                              │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                              │
│                                                                                                                                                                                  │
│ /home/kfike/Projects/beeware-tutorial/.venv/lib/python3.10/site-packages/briefcase/commands/create.py:765 in create_app                                                          │
│                                                                                                                                                                                  │
│   762 │   │   │   │   )                                                                                                                                                          │
│   763 │   │   │   │   return                                                                                                                                                     │
│   764 │   │   │   self.logger.info("Removing old application bundle...", prefix=app.app_name)                                                                                    │
│ ❱ 765 │   │   │   self.tools.shutil.rmtree(bundle_path)                                                                                                                          │
│   766 │   │                                                                                                                                                                      │
│   767 │   │   self.logger.info("Generating application template...", prefix=app.app_name)                                                                                        │
│   768 │   │   self.generate_app_template(app=app)                                                                                                                                │
│                                                                                                                                                                                  │
│ ╭──────────────────────────────────────────────── locals ────────────────────────────────────────────────╮                                                                       │
│ │         app = <sagefinancial.dev.helloworld v0.0.1 AppConfig>                                          │                                                                       │
│ │ bundle_path = PosixPath('/home/kfike/Projects/beeware-tutorial/helloworld/build/helloworld/pop/jammy') │                                                                       │
│ │     confirm = True                                                                                     │                                                                       │
│ │     options = {}                                                                                       │                                                                       │
│ │        self = <briefcase.platforms.linux.system.LinuxSystemCreateCommand object at 0x79626a9e6ef0>     │                                                                       │
│ │   test_mode = False                                                                                    │                                                                       │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                       │
│                                                                                                                                                                                  │
│ /usr/lib/python3.10/shutil.py:724 in rmtree                                                                                                                                      │
│                                                                                                                                                                                  │
│    721 │   │   │   return                                                                                                                                                        │
│    722 │   │   try:                                                                                                                                                              │
│    723 │   │   │   if os.path.samestat(orig_st, os.fstat(fd)):                                                                                                                   │
│ ❱  724 │   │   │   │   _rmtree_safe_fd(fd, path, onerror)                                                                                                                        │
│    725 │   │   │   │   try:                                                                                                                                                      │
│    726 │   │   │   │   │   os.close(fd)                                                                                                                                          │
│    727 │   │   │   │   │   fd_closed = True                                                                                                                                      │
│                                                                                                                                                                                  │
│ ╭─────────────────────────────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────────────────────────────╮ │
│ │            fd = 4                                                                                                                                                            │ │
│ │     fd_closed = False                                                                                                                                                        │ │
│ │ ignore_errors = False                                                                                                                                                        │ │
│ │       onerror = <function rmtree.<locals>.onerror at 0x79626aaa11b0>                                                                                                         │ │
│ │       orig_st = os.stat_result(st_mode=16749, st_ino=32266976, st_dev=64513, st_nlink=5, st_uid=1000, st_gid=1000, st_size=4096, st_atime=1716233792, st_mtime=1716233792,   │ │
│ │                 st_ctime=1716233927)                                                                                                                                         │ │
│ │          path = PosixPath('/home/kfike/Projects/beeware-tutorial/helloworld/build/helloworld/pop/jammy')                                                                     │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                                                                                                  │
│ /usr/lib/python3.10/shutil.py:663 in _rmtree_safe_fd                                                                                                                             │
│                                                                                                                                                                                  │
│    660 │   │   │   │   │   │   │   dirfd_closed = True                                                                                                                           │
│    661 │   │   │   │   │   │   │   os.rmdir(entry.name, dir_fd=topfd)                                                                                                            │
│    662 │   │   │   │   │   │   except OSError:                                                                                                                                   │
│ ❱  663 │   │   │   │   │   │   │   onerror(os.rmdir, fullname, sys.exc_info())                                                                                                   │
│    664 │   │   │   │   │   else:                                                                                                                                                 │
│    665 │   │   │   │   │   │   try:                                                                                                                                              │
│    666 │   │   │   │   │   │   │   # This can only happen if someone replaces                                                                                                    │
│                                                                                                                                                                                  │
│ ╭─────────────────────────────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────────────────────────────╮ │
│ │        dirfd = 5                                                                                                                                                             │ │
│ │ dirfd_closed = True                                                                                                                                                          │ │
│ │      entries = [                                                                                                                                                             │ │
│ │                │   <DirEntry 'helloworld-0.0.1'>,                                                                                                                            │ │
│ │                │   <DirEntry 'bootstrap'>,                                                                                                                                   │ │
│ │                │   <DirEntry 'Dockerfile'>,                                                                                                                                  │ │
│ │                │   <DirEntry '_requirements'>,                                                                                                                               │ │
│ │                │   <DirEntry 'briefcase.toml'>,                                                                                                                              │ │
│ │                │   <DirEntry 'helloworld.1'>                                                                                                                                 │ │
│ │                ]                                                                                                                                                             │ │
│ │        entry = <DirEntry 'helloworld-0.0.1'>                                                                                                                                 │ │
│ │     fullname = '/home/kfike/Projects/beeware-tutorial/helloworld/build/helloworld/pop/jammy/hell'+12                                                                         │ │
│ │       is_dir = True                                                                                                                                                          │ │
│ │      onerror = <function rmtree.<locals>.onerror at 0x79626aaa11b0>                                                                                                          │ │
│ │      orig_st = os.stat_result(st_mode=16893, st_ino=32267849, st_dev=64513, st_nlink=3, st_uid=1000, st_gid=1000, st_size=4096, st_atime=1716233792, st_mtime=1716233792,    │ │
│ │                st_ctime=1716233792)                                                                                                                                          │ │
│ │         path = PosixPath('/home/kfike/Projects/beeware-tutorial/helloworld/build/helloworld/pop/jammy')                                                                      │ │
│ │   scandir_it = <posix.ScandirIterator object at 0x79626aa91bc0>                                                                                                              │ │
│ │        topfd = 4                                                                                                                                                             │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                                                                                                  │
│ /usr/lib/python3.10/shutil.py:661 in _rmtree_safe_fd                                                                                                                             │
│                                                                                                                                                                                  │
│    658 │   │   │   │   │   │   try:                                                                                                                                              │
│    659 │   │   │   │   │   │   │   os.close(dirfd)                                                                                                                               │
│    660 │   │   │   │   │   │   │   dirfd_closed = True                                                                                                                           │
│ ❱  661 │   │   │   │   │   │   │   os.rmdir(entry.name, dir_fd=topfd)                                                                                                            │
│    662 │   │   │   │   │   │   except OSError:                                                                                                                                   │
│    663 │   │   │   │   │   │   │   onerror(os.rmdir, fullname, sys.exc_info())                                                                                                   │
│    664 │   │   │   │   │   else:                                                                                                                                                 │
│                                                                                                                                                                                  │
│ ╭─────────────────────────────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────────────────────────────╮ │
│ │        dirfd = 5                                                                                                                                                             │ │
│ │ dirfd_closed = True                                                                                                                                                          │ │
│ │      entries = [                                                                                                                                                             │ │
│ │                │   <DirEntry 'helloworld-0.0.1'>,                                                                                                                            │ │
│ │                │   <DirEntry 'bootstrap'>,                                                                                                                                   │ │
│ │                │   <DirEntry 'Dockerfile'>,                                                                                                                                  │ │
│ │                │   <DirEntry '_requirements'>,                                                                                                                               │ │
│ │                │   <DirEntry 'briefcase.toml'>,                                                                                                                              │ │
│ │                │   <DirEntry 'helloworld.1'>                                                                                                                                 │ │
│ │                ]                                                                                                                                                             │ │
│ │        entry = <DirEntry 'helloworld-0.0.1'>                                                                                                                                 │ │
│ │     fullname = '/home/kfike/Projects/beeware-tutorial/helloworld/build/helloworld/pop/jammy/hell'+12                                                                         │ │
│ │       is_dir = True                                                                                                                                                          │ │
│ │      onerror = <function rmtree.<locals>.onerror at 0x79626aaa11b0>                                                                                                          │ │
│ │      orig_st = os.stat_result(st_mode=16893, st_ino=32267849, st_dev=64513, st_nlink=3, st_uid=1000, st_gid=1000, st_size=4096, st_atime=1716233792, st_mtime=1716233792,    │ │
│ │                st_ctime=1716233792)                                                                                                                                          │ │
│ │         path = PosixPath('/home/kfike/Projects/beeware-tutorial/helloworld/build/helloworld/pop/jammy')                                                                      │ │
│ │   scandir_it = <posix.ScandirIterator object at 0x79626aa91bc0>                                                                                                              │ │
│ │        topfd = 4                                                                                                                                                             │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
PermissionError: [Errno 13] Permission denied: 'helloworld-0.0.1'

@bpirro
Copy link

bpirro commented May 20, 2024

I tried to re-create the issue where the create command continues, even after encountering an error. I'm running Windows 11 Version 23H2 (OS Build 22631.3593). I didn't encounter abnormal behavior.

[15:59:25]                                                                                                                                                             create.py:755
[15:59:28] Application 'helloworld' already exists; overwrite [y/N]?                                                                                                  console.py:705
           User input: y                                                                                                                                              console.py:705
                                                                                                                                                                       create.py:764
           [helloworld] Removing old application bundle...                                                                                                             create.py:764
           Saving log... started                                                                                                                                      console.py:390

Main thread traceback:
╭─────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────────╮
│ C:\Users\brian\PycharmProjects\beeware-tutorial\.venv\Lib\site-packages\briefcase\__main__.py:29 in main                                                                         │
│                                                                                                                                                                                  │
│   26 │   │   │   Path.cwd() / "pyproject.toml",                                                                                                                                  │
│   27 │   │   │   overrides=overrides,                                                                                                                                            │
│   28 │   │   )                                                                                                                                                                   │
│ ❱ 29 │   │   command(**options)                                                                                                                                                  │
│   30 │   except HelpText as e:                                                                                                                                                   │
│   31 │   │   logger.info()                                                                                                                                                       │
│   32 │   │   logger.info(str(e))                                                                                                                                                 │
│                                                                                                                                                                                  │
│ ╭──────────────────────────────────────────────── locals ────────────────────────────────────────────────╮                                                                       │
│ │       command = <briefcase.platforms.windows.app.WindowsAppCreateCommand object at 0x000002009AA1ACC0> │                                                                       │
│ │       Command = <class 'briefcase.platforms.windows.app.WindowsAppCreateCommand'>                      │                                                                       │
│ │       console = <briefcase.console.Console object at 0x000002009AAC3FE0>                               │                                                                       │
│ │ extra_cmdline = []                                                                                     │                                                                       │
│ │        logger = <briefcase.console.Log object at 0x000002009AAC3E60>                                   │                                                                       │
│ │       options = {}                                                                                     │                                                                       │
│ │     overrides = {}                                                                                     │                                                                       │
│ │       printer = <briefcase.console.Printer object at 0x000002009A923500>                               │                                                                       │
│ │        result = 0                                                                                      │                                                                       │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                       │
│                                                                                                                                                                                  │
│ C:\Users\brian\PycharmProjects\beeware-tutorial\.venv\Lib\site-packages\briefcase\commands\create.py:821 in __call__                                                             │
│                                                                                                                                                                                  │
│   818 │   │   else:                                                                                                                                                              │
│   819 │   │   │   state = None                                                                                                                                                   │
│   820 │   │   │   for app_name, app in sorted(self.apps.items()):                                                                                                                │
│ ❱ 821 │   │   │   │   state = self.create_app(app, **full_options(state, options))                                                                                               │
│   822 │   │                                                                                                                                                                      │
│   823 │   │   return state                                                                                                                                                       │
│   824                                                                                                                                                                            │
│                                                                                                                                                                                  │
│ ╭───────────────────────────────────────────── locals ──────────────────────────────────────────────╮                                                                            │
│ │      app = <com.example.helloworld v0.0.1 AppConfig>                                              │                                                                            │
│ │ app_name = 'helloworld'                                                                           │                                                                            │
│ │  options = {}                                                                                     │                                                                            │
│ │     self = <briefcase.platforms.windows.app.WindowsAppCreateCommand object at 0x000002009AA1ACC0> │                                                                            │
│ │    state = None                                                                                   │                                                                            │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                            │
│                                                                                                                                                                                  │
│ C:\Users\brian\PycharmProjects\beeware-tutorial\.venv\Lib\site-packages\briefcase\commands\create.py:765 in create_app                                                           │
│                                                                                                                                                                                  │
│   762 │   │   │   │   )                                                                                                                                                          │
│   763 │   │   │   │   return                                                                                                                                                     │
│   764 │   │   │   self.logger.info("Removing old application bundle...", prefix=app.app_name)                                                                                    │
│ ❱ 765 │   │   │   self.tools.shutil.rmtree(bundle_path)                                                                                                                          │
│   766 │   │                                                                                                                                                                      │
│   767 │   │   self.logger.info("Generating application template...", prefix=app.app_name)                                                                                        │
│   768 │   │   self.generate_app_template(app=app)                                                                                                                                │
│                                                                                                                                                                                  │
│ ╭─────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────╮                                                         │
│ │         app = <com.example.helloworld v0.0.1 AppConfig>                                                              │                                                         │
│ │ bundle_path = WindowsPath('C:/Users/brian/PycharmProjects/beeware-tutorial/helloworld/build/helloworld/windows/app') │                                                         │
│ │     confirm = True                                                                                                   │                                                         │
│ │     options = {}                                                                                                     │                                                         │
│ │        self = <briefcase.platforms.windows.app.WindowsAppCreateCommand object at 0x000002009AA1ACC0>                 │                                                         │
│ │   test_mode = False                                                                                                  │                                                         │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                         │
│                                                                                                                                                                                  │
│ C:\Python\Python312\Lib\shutil.py:796 in rmtree                                                                                                                                  │
│                                                                                                                                                                                  │
│    793 │   │   │   onexc(os.path.islink, path, err)                                                                                                                              │
│    794 │   │   │   # can't continue even if onexc hook returns                                                                                                                   │
│    795 │   │   │   return                                                                                                                                                        │
│ ❱  796 │   │   return _rmtree_unsafe(path, onexc)                                                                                                                                │
│    797                                                                                                                                                                           │
│    798 # Allow introspection of whether or not the hardening against symlink                                                                                                     │
│    799 # attacks is supported on the current platform                                                                                                                            │
│                                                                                                                                                                                  │
│ ╭──────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────╮                                                       │
│ │        dir_fd = None                                                                                                   │                                                       │
│ │ ignore_errors = False                                                                                                  │                                                       │
│ │       onerror = None                                                                                                   │                                                       │
│ │         onexc = <function rmtree.<locals>.onexc at 0x000002009B18A520>                                                 │                                                       │
│ │          path = WindowsPath('C:/Users/brian/PycharmProjects/beeware-tutorial/helloworld/build/helloworld/windows/app') │                                                       │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                       │
│                                                                                                                                                                                  │
│ C:\Python\Python312\Lib\shutil.py:631 in _rmtree_unsafe                                                                                                                          │
│                                                                                                                                                                                  │
│    628 │   │   │   except OSError as err:                                                                                                                                        │
│    629 │   │   │   │   onexc(os.path.islink, fullname, err)                                                                                                                      │
│    630 │   │   │   │   continue                                                                                                                                                  │
│ ❱  631 │   │   │   _rmtree_unsafe(fullname, onexc)                                                                                                                               │
│    632 │   │   else:                                                                                                                                                             │
│    633 │   │   │   try:                                                                                                                                                          │
│    634 │   │   │   │   os.unlink(fullname)                                                                                                                                       │
│                                                                                                                                                                                  │
│ ╭────────────────────────────────────────────────────────────────── locals ──────────────────────────────────────────────────────────────────╮                                   │
│ │    entries = [<DirEntry 'briefcase.toml'>, <DirEntry 'helloworld.wxs'>, <DirEntry 'icon.ico'>, <DirEntry 'src'>, <DirEntry 'unicode.wxl'>] │                                   │
│ │      entry = <DirEntry 'src'>                                                                                                              │                                   │
│ │   fullname = 'C:\\Users\\brian\\PycharmProjects\\beeware-tutorial\\helloworld\\build\\helloworld\\wind'+11                                 │                                   │
│ │     is_dir = True                                                                                                                          │                                   │
│ │      onexc = <function rmtree.<locals>.onexc at 0x000002009B18A520>                                                                        │                                   │
│ │       path = WindowsPath('C:/Users/brian/PycharmProjects/beeware-tutorial/helloworld/build/helloworld/windows/app')                        │                                   │
│ │ scandir_it = <nt.ScandirIterator object at 0x000002009A17E0C0>                                                                             │                                   │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                   │
│                                                                                                                                                                                  │
│ C:\Python\Python312\Lib\shutil.py:612 in _rmtree_unsafe                                                                                                                          │
│                                                                                                                                                                                  │
│    609 │   │   with os.scandir(path) as scandir_it:                                                                                                                              │
│    610 │   │   │   entries = list(scandir_it)                                                                                                                                    │
│    611 │   except OSError as err:                                                                                                                                                │
│ ❱  612 │   │   onexc(os.scandir, path, err)                                                                                                                                      │
│    613 │   │   entries = []                                                                                                                                                      │
│    614 │   for entry in entries:                                                                                                                                                 │
│    615 │   │   fullname = entry.path                                                                                                                                             │
│                                                                                                                                                                                  │
│ ╭─────────────────────────────────────────────── locals ────────────────────────────────────────────────╮                                                                        │
│ │ onexc = <function rmtree.<locals>.onexc at 0x000002009B18A520>                                        │                                                                        │
│ │  path = 'C:\\Users\\brian\\PycharmProjects\\beeware-tutorial\\helloworld\\build\\helloworld\\wind'+11 │                                                                        │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                        │
│                                                                                                                                                                                  │
│ C:\Python\Python312\Lib\shutil.py:609 in _rmtree_unsafe                                                                                                                          │
│                                                                                                                                                                                  │
│    606 # version vulnerable to race conditions                                                                                                                                   │
│    607 def _rmtree_unsafe(path, onexc):                                                                                                                                          │
│    608 │   try:                                                                                                                                                                  │
│ ❱  609 │   │   with os.scandir(path) as scandir_it:                                                                                                                              │
│    610 │   │   │   entries = list(scandir_it)                                                                                                                                    │
│    611 │   except OSError as err:                                                                                                                                                │
│    612 │   │   onexc(os.scandir, path, err)                                                                                                                                      │
│                                                                                                                                                                                  │
│ ╭─────────────────────────────────────────────── locals ────────────────────────────────────────────────╮                                                                        │
│ │ onexc = <function rmtree.<locals>.onexc at 0x000002009B18A520>                                        │                                                                        │
│ │  path = 'C:\\Users\\brian\\PycharmProjects\\beeware-tutorial\\helloworld\\build\\helloworld\\wind'+11 │                                                                        │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯                                                                        │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\brian\\PycharmProjects\\beeware-tutorial\\helloworld\\build\\helloworld\\windows\\app\\src'

image

@mhsmith
Copy link
Member

mhsmith commented May 20, 2024

It stops after the error on macOS as well, so we can close the issue.

@mhsmith mhsmith closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. good first issue Is this your first time contributing? This could be a good place to start!
Projects
None yet
Development

No branches or pull requests

8 participants