bitranox / lib_programname Goto Github PK
View Code? Open in Web Editor NEWDetermining the Name of a Process from Python
License: MIT License
Determining the Name of a Process from Python
License: MIT License
**I'm submitting a ... **
Do you want to request a feature or report a bug?
Reporting a bug.
What is the current behavior?
lib_programname fails to resolve the program name correctly when the program or a symbolic link pointing to the program has no extension.
**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
$ # the test script
$ cat test.py
#!/usr/bin/env python3
import lib_programname
# this returns the fully resolved path to the launched python program
path_to_program = lib_programname.get_path_executed_script() # type: pathlib.Path
print(path_to_program)
$ # running the script directly works
$ ./test.py
/Users/tester/test.py
$ # running the script with a .py named symlink works
$ ln -s test.py link2test.py
$ ./link2test.py
/Users/tester/test.py
$ rm link2test.py
$ # running the script with a symlink without an extension fails
$ ln -s test.py link2test
$ ./link2test
/usr/local/lib/python3.9/site-packages/lib_programname/lib_programname.py
$ # running the script directly also fails if it has no extension
$ mv test.py testme
$ ./testme
/usr/local/lib/python3.9/site-packages/lib_programname/lib_programname.py
$ # running the extension-less script with a .py named symlink works!
$ ln -s testme link2test.py
$ ./link2test.py
/Users/tester/testme
What is the expected behavior?
./link2test should have reported the same as ./link2test.py: /Users/tester/test.py
What is the motivation / use case for changing the behavior?
N/A
Please tell us about your environment:
**I'm submitting a ... **
Do you want to request a feature or report a bug?
What is the current behavior?
In python script, use:
import lib_programname
logName = Path(lib_programname.get_path_executed_script()).stem + '.log'
This works fine from the interpreter.
Now, use PyInstaller to build your application.
In the PyInstaller warn file I see:
missing module named lib_programname - imported by C:\Users\me\PycharmProjects\YouTube Utils\utterance_browser.py (top-level), myUtilities (top-level)
Unsuprisingly, if I run the resulting .exe I get:
ModuleNotFoundError: No module named 'lib_programname'
[21572] Failed to execute script 'comments_browser' due to unhandled exception!
My PyInstaller command line is:
pyinstaller myUtilties.py --clean --noconfirm --collect-data 'lib_programname'
I've also tried creating a .spec file and adding:
hiddenimports=['lib_programname'], which produces the same results as above.
**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
What is the expected behavior?
PyInstaller finds lib_programname and allows it to work with it's generated executable.
What is the motivation / use case for changing the behavior?
You can use PyInstaller to generate multiple exes, one for as many separate scripts as you desire. Each of those exe's should log errors to a log file formed from their name. This works great with lib_programname running in the interpreter, just not in the exe's produced by Pyinstaller
Please tell us about your environment:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.