Comments (4)
Yeah that would be great thanks! I mostly work on Unix platforms so I admit that I sometimes forget about windows compat. But I agree that this is probably worthwhile to fix and I'd be happy to accept a PR!! Thanks for reporting the bug!
Would you be able to provide a simple example of the code that is producing the error?
And I guess this is a question for you, but how would you like the interface to be regarding path separators?
Like basically do you want:
randomname generate adj/sound n/apex_predators
# or
randomname generate adj\sound n\apex_predators
from randomname.
Would you be able to provide a simple example of the code that is producing the error?
To be honest I can't really reproduce myself because I'm on a Mac 🤦🏻. This just came up in our CI. I think that something like this should reproduce it:
import randomname
from pathlib import Path
name = randomname.get_name()
Path(".", name).touch() # this should lead to the permission error
And I guess this is a question for you, but how would you like the interface to be regarding path separators?
How about we keep it like it is for the users and e.g. e.g. replace the any /
with os.sep
as first step?
I haven't looked into it too much tbh. My first step would be to set up a small CI workflow, write a test to reproduce the error and then explore the codebase. Probably on Saturday though and not today. I'd start with the CI + the test and then request review from you and then either ask you for feedback on my approach or make a separate PR for the fix (and then ask for feedback
from randomname.
Ok cool sounds good! Yeah the CI workflow would be a good place to start. And yeah separate PRs would probably be best practice
I guess I don't understand why there would be a /
in the generated name because I don't think it should allow that, hmmmm. The only reason I see that a slash would throw an error would be when loading the word lists from disk, but that would fail inside get_name
, not when trying to use the generated name.
If we wanted to change the windows interface to use their native os sep it'd be pretty straightforward to do:
(i.e. randomname generate adj\sound n\apex_predators
)
util.py
replace:
'/'.join
=>os.path.join
'{}/{}'.format
=>os.path.join
os.path.join(d, '**/*.txt')
=>os.path.join(d, '**', '*.txt')
'/'
=>os.sep
core.py
replace:
('adj/', 'n/')
=>('adj{}'.format(os.sep), 'n{}'.format(os.sep))
os.path.expanduser('~/.randomname')
=>os.path.expanduser(os.path.join('~', '.randomname'))
And I think that'd be enough? idk
Cuz actually, honestly on windows there's probably a Frankenstein mix of the two /
\
that I didn't really think about. But we'd probably need to do a bigger version release for that cuz it'd be a breaking change.
from randomname.
I'll have a look and let you know 👍🏻 Thanks for your responsiveness!
from randomname.
Related Issues (10)
- Enforce exactly two words in randomname.get_name
- feature: pass in seed for repeatability
- show collision probability HOT 2
- Add ability to expand to other word lists
- Add ability to blacklist certain words
- Ability to define a new delimiter? HOT 2
- docssssssss
- feature: pass max length for resulting name HOT 2
- Crash when using randomname in application packed with PyInstaller HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from randomname.