Execution is failing with AttributeError: module 'ctypes' has no attribute 'windll'
Hi Brian,
I am trying to run CLI version of your tools, but it is failing with the following error:
File "/home/ubuntu/tools/OneDriveExplorer/OneDriveExplorer/OneDriveExplorer.py", line 39, in
I additionally I installed pywin32-ctypes (0.2.2) via pip, but it did not helped.
Could you please suggest how to fix it ?
Also would you considered adding pyproject-toml, so it is possible to deploy your project directly with PIP ?
https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
Thank you
Requirements satisfied:
Requirement already satisfied: ttkthemes in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 1)) (3.2.2) Requirement already satisfied: Pillow in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 2)) (10.4.0) Requirement already satisfied: pandas in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 3)) (2.2.2) Requirement already satisfied: numpy in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 4)) (2.0.0) Requirement already satisfied: pytz in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 5)) (2024.1) Requirement already satisfied: python-registry in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 6)) (1.3.1) Requirement already satisfied: keyboard in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 7)) (0.13.5) Requirement already satisfied: openpyxl in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 8)) (3.1.5) Requirement already satisfied: pandastable in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 9)) (0.13.1) Requirement already satisfied: dissect.cstruct in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 10)) (4.0) Requirement already satisfied: psutil in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 11)) (6.0.0) Requirement already satisfied: pytsk3 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 12)) (20231007) Requirement already satisfied: quickxorhash in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 13)) (1.0.5) Requirement already satisfied: pycryptodome in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 14)) (3.20.0) Requirement already satisfied: ruamel.yaml in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 15)) (0.18.6) Requirement already satisfied: Cerberus in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from -r requirements.txt (line 16)) (1.3.5) Requirement already satisfied: python-dateutil>=2.8.2 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from pandas->-r requirements.txt (line 3)) (2.9.0.post0) Requirement already satisfied: tzdata>=2022.7 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from pandas->-r requirements.txt (line 3)) (2024.1) Requirement already satisfied: enum-compat in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from python-registry->-r requirements.txt (line 6)) (0.0.3) Requirement already satisfied: unicodecsv in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from python-registry->-r requirements.txt (line 6)) (0.14.1) Requirement already satisfied: et-xmlfile in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from openpyxl->-r requirements.txt (line 8)) (1.1.0) Requirement already satisfied: matplotlib>=3.0 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from pandastable->-r requirements.txt (line 9)) (3.9.1) Requirement already satisfied: numexpr>=2.4 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from pandastable->-r requirements.txt (line 9)) (2.10.1) Requirement already satisfied: xlrd>=0.9 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from pandastable->-r requirements.txt (line 9)) (2.0.1) Requirement already satisfied: future in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from pandastable->-r requirements.txt (line 9)) (1.0.0) Requirement already satisfied: ruamel.yaml.clib>=0.2.7 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from ruamel.yaml->-r requirements.txt (line 15)) (0.2.8) Requirement already satisfied: contourpy>=1.0.1 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from matplotlib>=3.0->pandastable->-r requirements.txt (line 9)) (1.2.1) Requirement already satisfied: cycler>=0.10 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from matplotlib>=3.0->pandastable->-r requirements.txt (line 9)) (0.12.1) Requirement already satisfied: fonttools>=4.22.0 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from matplotlib>=3.0->pandastable->-r requirements.txt (line 9)) (4.53.1) Requirement already satisfied: kiwisolver>=1.3.1 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from matplotlib>=3.0->pandastable->-r requirements.txt (line 9)) (1.4.5) Requirement already satisfied: packaging>=20.0 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from matplotlib>=3.0->pandastable->-r requirements.txt (line 9)) (24.1) Requirement already satisfied: pyparsing>=2.3.1 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from matplotlib>=3.0->pandastable->-r requirements.txt (line 9)) (3.1.2) Requirement already satisfied: six>=1.5 in /home/ubuntu/pyOneDrive/lib/python3.12/site-packages (from python-dateutil>=2.8.2->pandas->-r requirements.txt (line 3)) (1.16.0)
OneDriveExplorer only works on Windows. The CLI version will probably work. You can comment out lines 45 and 46 in odl.py. Let me know if this works and I can put in a fix for the CLI. The GUI would take more effort to make it cross platform.
https://github.com/Beercow/OneDriveExplorer/blob/925e5b507542202e0c2430b57d6c6aa6755907bb/OneDriveExplorer/ode/parsers/odl.py#L45
https://github.com/Beercow/OneDriveExplorer/blob/925e5b507542202e0c2430b57d6c6aa6755907bb/OneDriveExplorer/ode/parsers/odl.py#L46
Hi Brian,
the cli script now start, but it does not parse the .dat file. I tested the file in the compiled Windows version and it worked fine. 535086f03efc0fb2.dat.zip
Second issue I had was that what what ever reason I was not able to get autocomplete on the filename, had to put it into the cli manually. Other scripts in that virtenv works fine.
And one more SyntaxWarning for deprecated escaping syntax. This is probably related to changes in Python 3.12 https://docs.python.org/dev/whatsnew/3.12.html#other-language-changes
python3 OneDriveExplorer.py -f ./535086f03efc0fb2.dat --debug /home/ubuntu/tools/OneDriveExplorer/OneDriveExplorer/OneDriveExplorer.py:183: SyntaxWarning: invalid escape sequence '\ ' print('Error: Remove trailing \ from directory.\nExample: --json "c:\temp" ') /home/ubuntu/tools/OneDriveExplorer/OneDriveExplorer/OneDriveExplorer.py:191: SyntaxWarning: invalid escape sequence '\ ' print('Error: Remove trailing \ from directory.\nExample: --csv "c:\temp" ') /home/ubuntu/tools/OneDriveExplorer/OneDriveExplorer/OneDriveExplorer.py:199: SyntaxWarning: invalid escape sequence '\ ' print('Error: Remove trailing \ from directory.\nExample: --html "c:\temp" ')
2024-07-19 18:48:17, INFO, Start parsing .\535086f03efc0fb2.dat.
Unable to parse .\535086f03efc0fb2.dat.
2024-07-19 18:48:17, WARNING, Unable to parse .\535086f03efc0fb2.dat.
Thank you for your time
Not sure what would cause the autocomplete issue (has nothing to do with the program). The other thing that comes to mind would be to check the line endings of the files. It was written on Windows so the line endings may be \r\n.
Regards the autocomplete, it is affected by the short -f switch, as you can se bellow it only show .py files and folders
python3 OneDriveExplorer.py -f
Images/ OneDriveExplorer.py OneDriveExplorer_GUI.py ode/
cstructs/
Long switch --file will work fine and will show all the files .txt and .dat included. No idea what is the root case, my bet is something with the Python vir env, but since Ubuntu does not allow installing pip packages system wide, this may come up more often.
python3 OneDriveExplorer.py --file
535086f03efc0fb2.dat build.spec ode/ requirements.txt
Images/ OneDriveExplorer.py OneDriveExplorer_GUI.py cstructs/
For the rest I check the end lines, and converted the script to LF, but it had no effect.
I saw you using this to parse out filename and path: account = os.path.dirname(args.file.replace('/', '\')).rsplit('\', 1)[-1] name = os.path.split(args.file)[1]
I refactor it to more OS agnostic way. normalized_path = os.path.normpath(args.file) accountn = os.path.basename(os.path.dirname(normalized_path)) namen = os.path.basename(normalized_path)
When executed your account variable is empty, the normalized_path account path has value DATA. But DataFrame is not loading any data either way.
python3 OneDriveExplorer.py --file $HOME/DATA/535086f03efc0fb2.dat
args.file'/home/ubuntu/DATA/535086f03efc0fb2.dat' name'535086f03efc0fb2.dat' account'' normalized_path'/home/ubuntu/DATA/535086f03efc0fb2.dat' account_normalized'DATA' name_normalized'535086f03efc0fb2.dat' ORIG Empty DataFrame Columns: [] Index: [] Empty DataFrame Columns: [] Index: [] Empty DataFrame Columns: [] Index: [] [] ############### Normalized Path Empty DataFrame Columns: [] Index: [] Empty DataFrame Columns: [] Index: [] Empty DataFrame Columns: [] Index: [] [] Unable to parse \home\ubuntu\DATA\535086f03efc0fb2.dat.
I attached code snippet I used for debugging, but I am kind of stuck on this. Any idea what can be the problem ? OneDriveExplorer_debug_snippet.txt
Closing for now. Not supporting linux at this time.