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

AttributeError: type object 'WindowsPath' has no attribute '_flavour' #2808

Open
AliAsgerSaify opened this issue Feb 14, 2025 · 3 comments
Open

Comments

@AliAsgerSaify
Copy link

Prerequisite

  • Make sure no duplicated issue has already been reported. You should look for closed issues, too.
  • Make sure you are not asking us to help to solve your specific issue. GitHub issues are opened mainly for development purposes. If you want to ask someone to help to solve your problem, go to some community site like StackOverflow, etc.
  • Make sure your problem is not derived from packaging (e.g. Homebrew).

Describe the bug
when running python setup.py build one project is building sucessfully and another is facing issues in building, given path for both project is same that is E:\PycharmProjects. I have uninstall and re-install cx freeze in that project but the error still exists. I even tried installing different versions still the error exists.

Error:
Traceback (most recent call last):
File "E:\PycharmProjects\pdf2Text\setup.py", line 1, in
import cx_Freeze
File "E:\PycharmProjects\pdf2Text.venv\Lib\site-packages\cx_Freeze_init_.py", line 12, in
from .command.build_exe import BuildEXE as build_exe
File "E:\PycharmProjects\pdf2Text.venv\Lib\site-packages\cx_Freeze\command\build_exe.py", line 11, in
from cx_Freeze.common import normalize_to_list
File "E:\PycharmProjects\pdf2Text.venv\Lib\site-packages\cx_Freeze\common.py", line 22, in
class FilePath(Path):
...<13 lines>...
return self.class(target)
File "E:\PycharmProjects\pdf2Text.venv\Lib\site-packages\cx_Freeze\common.py", line 25, in FilePath
_flavour = type(Path())._flavour
^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'WindowsPath' has no attribute '_flavour'

To Reproduce
Steps to reproduce the behavior (a setup.py or a minimal code sample will be good)
import cx_Freeze
from cx_Freeze import setup, Executable
import sys
import datetime

base = "Win32GUI" if sys.platform=="win32" else None

executables = [Executable("window.py", base=base, icon="./save.ico",
target_name="PDF2TEXT", copyright="Ali Asger")]

packages = ["PyPDF2","tkinter"]

packages = ["PyPDF2","tkinter","json","pandas"]

options ={
'build.exe':
{
"packages": packages,

    },

}

setup(name="PDF2TEXT",
options = options,
version = 0.1,
description= "PDF2TEXT Program Made By Ali Asger in python language",
executables = executables)

Expected behavior
A clear and concise description of what you expected to happen.

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

Desktop (please complete the following information):

  • Platform information (e.g. Ubuntu Linux 22.04): Windows 10 Pro
  • OS architecture (e.g. amd64): x64-based PC
  • cx_Freeze version [e.g. 6.11]: 6.15.11
  • Python version [e.g. 3.10]: 3.10.3

Additional context
Add any other context about the problem here.

@marcelotduarte
Copy link
Owner

marcelotduarte commented Feb 14, 2025

This bug doesn't exist anymore. Try the latest version 7.2.10.

EDIT:
And if I remember correctly, it didn't work with py 3.12, but it worked with py 3.10.

@AliAsgerSaify
Copy link
Author

AliAsgerSaify commented Feb 15, 2025

I have upgraded the module to 7.2.10. In the latest version also there is an error, below is the produced error:
Traceback (most recent call last):
File "E:\PycharmProjects\pdf2Text\setup.py", line 1, in
import cx_Freeze
File "E:\PycharmProjects\pdf2Text.venv\Lib\site-packages\cx_Freeze_init_.py", line 32, in
from cx_Freeze.command.bdist_msi import bdist_msi
File "E:\PycharmProjects\pdf2Text.venv\Lib\site-packages\cx_Freeze\command\bdist_msi.py", line 31, in
from msilib import ( # pylint: disable=deprecated-module
...<15 lines>...
)
ModuleNotFoundError: No module named 'msilib'

my python version is 3.13.1. Sorry for mistake

@marcelotduarte
Copy link
Owner

cx_Freeze doesn't support (yet) Python 3.13.

You can test the latest development build:

pip uninstall cx_Freeze
pip install --extra-index-url https://test.pypi.org/simple/ cx_Freeze --pre --no-cache

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