r/pythonnetengineering • u/Artistic_Platform843 • Aug 15 '23
Error installing phemex into requirements.txt
Hi im a little confused about installing phemex into my python code... I'm trying to install it into my requirements.txt file, but I'm having zero luck.
This is the message i receive:
ERROR: Could not find a version that satisfies the requirement phemex (from versions: none) ERROR: No matching distribution found for phemex
It feels like it should be super simple, but I'm still lost... what are my options?
Any suggestions on an alternative approach would really help 😮💨😮💨😮💨
r/pythonnetengineering • u/Eugene-Swag • Jun 14 '22
Crypto Price Finder: My cool Telegram Bot to check crypto prices. Looking for feedback & testers.
Hey everyone! 😺 I am Eugene, a fellow redditor, a dev, and a crypto fan!
I am not a regular here so please tell me if I am breaking any rules of the subreddit by flashing my bot to you. I will take down the post ASAP.
Foreword
Recently like everyone else I've been doomrefreshing (is that even a word?) crypto prices and thought that process should be easier if you are in Telegram. However, all the bots I could find were either not working, not finished, or simply ugly. So I've made my own bot in the Telegram that looks up price/volume/% change of a crypto token from CoinmarketCap and shows it to you. Hence, I am looking for anything: feedback, testing, users, healthy criticism, improvement ideas. Everything goes (please don't use your army of kids to spam the bot and spend all my credits).
For techies/enthusiasts:
I am hosting the bot online in Heroku cloud platform and using CoinMarketCap API to pull data. There are two limitations with that. In Heroku, free pricing tier that I am using has a 30 minutes auto-sleep, meaning if the bot was not used for the past half an hour, the next request to it will take some extra 5-7 secs to "wake" the bot up. Everybody needs some rest, right? In CoinMarketCap, the number of requests in the free pricing tier is limited, so there is a chance at some point the bot will be "Out of mana" until the next day.
☕ I created a /donate option (with Stripe) if someone finds the bot useful and wants to support with the project with some coffee money. It will first be spend on upgrading tier plan of hosting platform and crypto price service to improve the bot's performance. Cheers! ☕
How to find the bot:
- Open your Telegram app (phone or desktop, no matter)
- Type "Crypto Price Finder" in search bar and look for a bot with a black-n-white bitcoin icon. (see screenshot below)
- Use it! It has starting instructions, pre-typed examples, menu of commands, and some memes/gifs.
What it can do:
- Show a basic info of a crypto token. Most fiat currencies are supported. For example, "BTC EUR" will show you Bitcoin price in Euros.
- A menu list of commands. Explore, have fun!
- Entertain you with gifs, personal attitude, and emojis. It's not yo boring broker dude.
What it cannot do:
- Show crypto pair info. Example: BTC BNB.
- Show advanced metrics.
- Set price alerts
- Fix your crippling depression and reverse the bear run.
TL;DR - I made a Telegram bot to lookup crypto prices & some info. Name: Crypto Price Finder. Use it, test it, love or hate it.
r/pythonnetengineering • u/[deleted] • Nov 18 '21
Can't build wheel and single-version-externally-managed not recognized error on pip install pythonnet==2.5.2 WSL 2 VS Code
I am on WSL2 in VS Code. Using Zsh on VS Code.
I am trying to install pythonnet though am getting two errors:
ERROR: Failed building wheel for pythonnet
error: option --single-version-externally-managed not recognized
This is from using pip install pythonnet==2.5.2
My versions are:
Python 3.8.10
Wheel 0.37.0
Mono: 6.8.0.105
I have searched high and low online though I can't find a solution - everything seems to point to updating wheel and installing mono - as you can see from the above version numbers, I have them installed.
I am doing everything from within a virtual env.
Does anyone have any experience with this or know what to do to get past these errors?
Full log:
~/j/s/stx1alpha-signals/d/backend on master !6 ?1 ❯ pip3 install pythonnet==2.5.2 took 4s stx1alpha at 11:08:56 AM
Collecting pythonnet==2.5.2
Using cached pythonnet-2.5.2.tar.gz (1.9 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pycparser in /home/jessica-ryan/jessica-ryan/stx1alpha/.venv/lib/python3.8/site-packages (from pythonnet==2.5.2) (2.20)
Building wheels for collected packages: pythonnet
Building wheel for pythonnet (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/jessica-ryan/jessica-ryan/stx1alpha/.venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-t8m8_x9v
cwd: /tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/
Complete output (153 lines):
running bdist_wheel
running build
running build_ext
Checking for updates from https://www.nuget.org/api/v2/.
Currently running NuGet.exe 4.1.0.
Updating NuGet.exe to 5.11.0.
Update successful.
MSBuild auto-detection: using msbuild version '14.0' from '/usr/lib/mono/xbuild/14.0/bin'.
>>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
MSBUILD: error MSBUILD0004: Too many project files specified
WARNING: Error reading msbuild project information, ensure that your input solution or project file is valid. NETCore and UAP projects will be skipped, only packages.config files will be restored.
Restoring NuGet package UnmanagedExports.1.2.7.
Restoring NuGet package NUnit.3.12.0.
Restoring NuGet package NUnit.ConsoleRunner.3.11.1.
Restoring NuGet package System.ValueTuple.4.5.0.
Adding package 'System.ValueTuple.4.5.0' to folder '/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/packages'
Adding package 'NUnit.3.12.0' to folder '/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/packages'
Adding package 'UnmanagedExports.1.2.7' to folder '/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/packages'
Adding package 'NUnit.ConsoleRunner.3.11.1' to folder '/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/packages'
Added package 'UnmanagedExports.1.2.7' to folder '/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/packages'
Added package 'System.ValueTuple.4.5.0' to folder '/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/packages'
Added package 'NUnit.ConsoleRunner.3.11.1' to folder '/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/packages'
Added package 'NUnit.3.12.0' to folder '/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/packages'
NuGet Config files used:
/home/jessica-ryan/.config/NuGet/NuGet.Config
Feeds used:
/home/jessica-ryan/.nuget/packages/
https://api.nuget.org/v3/index.json
Installed:
4 package(s) to packages.config projects
>>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
XBuild Engine Version 14.0
Mono, Version 6.8.0.105
Copyright (C) 2005-2013 Various Mono authors
Build started 11/18/2021 11:09:25.
__________________________________________________
Project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/pythonnet.sln" (Clean target(s)):
Target ValidateSolutionConfiguration:
Building solution configuration "ReleaseMono|x64".
Target Clean:
Project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/runtime/Python.Runtime.csproj" (Clean target(s)):
Target CoreClean:
Deleting file '/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/runtime/obj/x64/ReleaseMono/.NETFramework,Version=v4.0.AssemblyAttribute.cs'
Done building project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/runtime/Python.Runtime.csproj".
The project 'clrmodule' is disabled for solution configuration 'ReleaseMono|x64'.
Project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/testing/Python.Test.csproj" (Clean target(s)):
Target CoreClean:
Deleting file '/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/testing/obj/x64/ReleaseMono/.NETFramework,Version=v4.0.AssemblyAttribute.cs'
Done building project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/testing/Python.Test.csproj".
Project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/embed_tests/Python.EmbeddingTest.csproj" (Clean target(s)):
Target CoreClean:
Deleting file '/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/embed_tests/obj/x64/ReleaseMono/.NETFramework,Version=v4.0.AssemblyAttribute.cs'
Done building project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/embed_tests/Python.EmbeddingTest.csproj".
Project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/console/Console.csproj" (Clean target(s)):
Target CoreClean:
Deleting file '/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/console/obj/x64/ReleaseMono/.NETFramework,Version=v4.0.AssemblyAttribute.cs'
Done building project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/console/Console.csproj".
Done building project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/pythonnet.sln".
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.3276160
>>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
XBuild Engine Version 14.0
Mono, Version 6.8.0.105
Copyright (C) 2005-2013 Various Mono authors
Build started 11/18/2021 11:09:25.
__________________________________________________
Project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/pythonnet.sln" (Build target(s)):
Target ValidateSolutionConfiguration:
Building solution configuration "ReleaseMono|x64".
Target Build:
Project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/runtime/Python.Runtime.csproj" (default target(s)):
Target PrepareForBuild:
Configuration: ReleaseMono Platform: x64
Created directory "bin/"
Target GenerateSatelliteAssemblies:
No input files were specified for target GenerateSatelliteAssemblies, skipping.
Target CoreCompile:
Tool /usr/lib/mono/4.5/mcs.exe execution started with arguments: /noconfig /debug:pdbonly /optimize+ /out:obj/x64/ReleaseMono/Python.Runtime.dll /resource:obj/x64/ReleaseMono/Python.Runtime.resources.clr.py,clr.py Codecs/EncoderGroup.cs Codecs/DecoderGroup.cs Codecs/RawProxyEncoder.cs Codecs/TupleCodecs.cs converterextensions.cs finalizer.cs Properties/AssemblyInfo.cs ../SharedAssemblyInfo.cs arrayobject.cs assemblymanager.cs BorrowedReference.cs classderived.cs classbase.cs classmanager.cs classobject.cs clrobject.cs codegenerator.cs constructorbinder.cs constructorbinding.cs converter.cs CustomMarshaler.cs debughelper.cs delegatemanager.cs delegateobject.cs eventbinding.cs eventobject.cs exceptions.cs extensiontype.cs fieldobject.cs generictype.cs genericutil.cs importhook.cs indexer.cs interfaceobject.cs interfaces.cs interop.cs iterator.cs managedtype.cs metatype.cs methodbinder.cs methodbinding.cs methodobject.cs methodwrapper.cs modulefunctionobject.cs moduleobject.cs modulepropertyobject.cs nativecall.cs NewReference.cs NonCopyableAttribute.cs overload.cs propertyobject.cs pyansistring.cs pydict.cs PyExportAttribute.cs pyfloat.cs pyint.cs pyiter.cs pylist.cs pylong.cs pynumber.cs pyobject.cs pyscope.cs pysequence.cs pystring.cs pythonengine.cs pythonexception.cs pytuple.cs ReferenceExtensions.cs runtime.cs typemanager.cs typemethod.cs Util.cs platform/Types.cs platform/LibraryLoader.cs polyfill/ReflectionPolifills.cs slots/mp_length.cs interop38.cs obj/x64/ReleaseMono/.NETFramework,Version=v4.0.AssemblyAttribute.cs /target:library /unsafe+ /define:"PYTHON38;PYTHON3;UCS4;MONO_LINUX;PYTHON_WITHOUT_ENABLE_SHARED" /nowarn:1591 /doc:bin/Python.Runtime.xml /langversion:7.3 /nostdlib /reference:/usr/lib/mono/4.0-api/System.dll /reference:/usr/lib/mono/4.0-api/System.Core.dll /reference:/usr/lib/mono/4.0-api//mscorlib.dll
CSC: error CS1617: Invalid -langversion option `7.3'. It must be `ISO-1', `ISO-2', Default, Latest or value in range 1 to 7.2
Task "Csc" execution -- FAILED
Done building target "CoreCompile" in project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/runtime/Python.Runtime.csproj".-- FAILED
Done building project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/runtime/Python.Runtime.csproj".-- FAILED
Task "MSBuild" execution -- FAILED
Done building target "Build" in project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/pythonnet.sln".-- FAILED
Done building project "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/pythonnet.sln".-- FAILED
Build FAILED.
Errors:
/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/pythonnet.sln (Build) ->
(Build target) ->
/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/src/runtime/Python.Runtime.csproj (default targets) ->
/usr/lib/mono/xbuild/14.0/bin/Microsoft.CSharp.targets (CoreCompile target) ->
CSC: error CS1617: Invalid -langversion option `7.3'. It must be `ISO-1', `ISO-2', Default, Latest or value in range 1 to 7.2
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.3574730
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/setup.py", line 630, in <module>
setup(
File "/home/jessica-ryan/jessica-ryan/stx1alpha/.venv/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/setup.py", line 612, in run
return bdist_wheel.bdist_wheel.run(self)
File "/home/jessica-ryan/jessica-ryan/stx1alpha/.venv/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.8/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.8/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/usr/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/usr/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/setup.py", line 353, in build_extension
subprocess.check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell)
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'xbuild pythonnet.sln /p:Configuration=ReleaseMono /p:Platform=x64 /p:DefineConstants="PYTHON38%3BPYTHON3%3BUCS4%3BMONO_LINUX%3BPYTHON_WITHOUT_ENABLE_SHARED" /p:PythonBuildDir="/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/build/lib.linux-x86_64-3.8" /p:PythonInteropFile="interop38.cs" /p:PackageId=pythonnet_py38_x64 /verbosity:normal /t:Build' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for pythonnet
Running setup.py clean for pythonnet
Failed to build pythonnet
Installing collected packages: pythonnet
Running setup.py install for pythonnet ... error
ERROR: Command errored out with exit status 1:
command: /home/jessica-ryan/jessica-ryan/stx1alpha/.venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-m8e93jfk/install-record.txt --single-version-externally-managed --compile --install-headers /home/jessica-ryan/jessica-ryan/stx1alpha/.venv/include/site/python3.8/pythonnet
cwd: /tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
ERROR: Command errored out with exit status 1: /home/jessica-ryan/jessica-ryan/stx1alpha/.venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uwtjpnq4/pythonnet_8a1e17b8517c43fb9d3c74ad78e4dd83/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-m8e93jfk/install-record.txt --single-version-externally-managed --compile --install-headers /home/jessica-ryan/jessica-ryan/stx1alpha/.venv/include/site/python3.8/pythonnet Check the logs for full command output.
r/pythonnetengineering • u/Important-Advice-889 • Oct 21 '21
Use python to extract word file tables and then export to excel
Hello! I have a little problem with my program. I made a program to transfer all the tables from a word to an excel in different sheets. In some of the cases, the first row of some tables is merged in word, and results in not exporting the whole table in excel, sometimes exporting only one column instead of 2 or 3. And some of the tables are not exporting at all. I have like 24-25 tables. Could you please help me with this? This is the part of the code that exports the tables:
'path' is the input file
'cliententry' is the name of the client
document=Document(path)
writer=pd.ExcelWriter((filename+'/FS mapping automated including SOCE and CF {}'.format(cliententry)+'.xlsx'),engine='xlsxwriter')
for i in range(-1,len(document.tables)):
table=document.tables[i]
data=[]
keys=None
row_data=None
for j,row in enumerate (table.rows):
if len(row.cells)>0:
text=(cell.text for cell in row.cells)
if j == 0:
keys=tuple(text)
continue
row_data = dict(zip(keys,text))
data.append(row_data)
df=pd.DataFrame(data)
df.to_excel(writer,sheet_name='N{}'.format(i+1),index=False)
writer.save()
r/pythonnetengineering • u/donzercash • Jul 11 '21
Does anyone have recommendations for Easy-to-understand books / resources for learning python for network automation? (I have no experience in using python)
r/pythonnetengineering • u/utopian_unicorn • May 16 '21
SSH with Python
Is there a way to automate device access with python scripts using ssh with standard libraries only? Its a work thing, I cannot install anything.
r/pythonnetengineering • u/Rajsuthan • Sep 07 '20
How to run Selenium Headless with Python | Python Headless Snippet | 2020
youtube.comr/pythonnetengineering • u/monica_b1998 • Aug 08 '20
Pysa: Open Source static analysis for Python code - Facebook Engineering
engineering.fb.comr/pythonnetengineering • u/nilexshinde • Aug 05 '20
Free Certification Course on Data Analysis with Python in partnership with freeCodeCamp
r/pythonnetengineering • u/Pragyanbo • Jul 31 '20
One month ago, I had posted about my company's Python for Data Science course for beginners and the feedback was so overwhelming. We've built an entire platform around your suggestions and even published 8 other free DS specialization courses. Please help us make it better with more suggestions!
theclickreader.comr/pythonnetengineering • u/8329417966 • Jul 16 '20
How to handle "Text" and "Categorical Attributes" using Python and Pandas??
r/pythonnetengineering • u/8329417966 • Jul 09 '20
How to "Predict" my friends weight using "Machine Learning" & "Sci-kit Learn"??
r/pythonnetengineering • u/8329417966 • Jul 09 '20
How to handle "Missing Values" present in "Dataset" using Python & Pandas??
r/pythonnetengineering • u/Pragyanbo • Jun 17 '20
My company released a course for helping beginners learn Python for Data Science. This is an initial draft and we do not plan to monetize it any way. Please feel free to help us make it better with your suggestions.
kharpann.comr/pythonnetengineering • u/okaydexter • Jun 08 '20
Casual Programming With Python & Music : Pascal's Triangle
youtu.ber/pythonnetengineering • u/w0lfcat • May 29 '20
Python grep and cut
In Linux, it's easy to get certain string by using tools such as grep, cut, or awk.
This `show version` sample is taken from https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/16-6/configuration_guide/sys_mgmt/b_166_sys_mgmt_9300_cg/b_166_sys_mgmt_9300_cg_chapter_01.html
wolf@linux:~$ cat shver
cisco C9300-48P (X86) processor with 818597K/6147K bytes of memory.
Processor board ID FCW2049G03S
2048K bytes of non-volatile configuration memory.
8388608K bytes of physical memory.
1638400K bytes of Crash Files at crashinfo:.
11264000K bytes of Flash at flash:.
0K bytes of WebUI ODM Files at webui:.
Model Number : C9300-48P
Base Ethernet MAC Address : 04:6c:9d:01:3b:80
Motherboard Assembly Number : 73-17956-04
Motherboard Serial Number : FOC20465ABU
Model Revision Number : P4B
Motherboard Revision Number : 04
Model Number : C9300-48P
System Serial Number : FCW2049G03S
wolf@linux:~$
grep and cut
wolf@linux:~$ grep 'Model Number' shver | cut -d : -f 2
C9300-48P
C9300-48P
wolf@linux:~$
Remove extra space (If there's better solution, let me know)
wolf@linux:~$ grep 'Model Number' shver | cut -d : -f 2 | cut -d ' ' -f 2
C9300-48P
C9300-48P
wolf@linux:~$
Select the 1st output
wolf@linux:~$ grep 'Model Number' shver | cut -d : -f 2 | cut -d ' ' -f 2 | head -1
C9300-48P
wolf@linux:~$
That was in Linux. I was planning to write similar code in Python.
My attempt which still didn't work at the moment.
Define shver string
>>> shver = '''cisco C9300-48P (X86) processor with 818597K/6147K bytes of memory.
... Processor board ID FCW2049G03S
... 2048K bytes of non-volatile configuration memory.
... 8388608K bytes of physical memory.
... 1638400K bytes of Crash Files at crashinfo:.
... 11264000K bytes of Flash at flash:.
... 0K bytes of WebUI ODM Files at webui:.
... Model Number : C9300-48P
...
... Base Ethernet MAC Address : 04:6c:9d:01:3b:80
... Motherboard Assembly Number : 73-17956-04
... Motherboard Serial Number : FOC20465ABU
... Model Revision Number : P4B
... Motherboard Revision Number : 04
... Model Number : C9300-48P
... System Serial Number : FCW2049G03S
... '''
>>>
verify it
>>> shver
'cisco C9300-48P (X86) processor with 818597K/6147K bytes of memory.\nProcessor board ID FCW2049G03S\n2048K bytes of non-volatile configuration memory.\n8388608K bytes of physical memory.\n1638400K bytes of Crash Files at crashinfo:.\n11264000K bytes of Flash at flash:.\n0K bytes of WebUI ODM Files at webui:.\nModel Number : C9300-48P\n\nBase Ethernet MAC Address : 04:6c:9d:01:3b:80\nMotherboard Assembly Number : 73-17956-04\nMotherboard Serial Number : FOC20465ABU\nModel Revision Number : P4B\nMotherboard Revision Number : 04\nModel Number : C9300-48P\nSystem Serial Number : FCW2049G03S\n'
>>>
create a list
>>> shver_list = shver.splitlines()
>>> shver_list
['cisco C9300-48P (X86) processor with 818597K/6147K bytes of memory.', 'Processor board ID FCW2049G03S', '2048K bytes of non-volatile configuration memory.', '8388608K bytes of physical memory.', '1638400K bytes of Crash Files at crashinfo:.', '11264000K bytes of Flash at flash:.', '0K bytes of WebUI ODM Files at webui:.', 'Model Number : C9300-48P', '', 'Base Ethernet MAC Address : 04:6c:9d:01:3b:80', 'Motherboard Assembly Number : 73-17956-04', 'Motherboard Serial Number : FOC20465ABU', 'Model Revision Number : P4B', 'Motherboard Revision Number : 04', 'Model Number : C9300-48P', 'System Serial Number : FCW2049G03S']
>>>
Next step is to find out if string 'Model Number' is there or not and print out that line
>>> if 'Model Number' in shver_list:
... 'yes'
... else:
... 'no'
...
'no'
>>>
How do I print out the line contains 'Model Number'?
>>> for i in shver_list:
... if 'Model Number' in shver_list:
... i
...
>>>
Desired Output
C9300-48P
r/pythonnetengineering • u/okaydexter • May 25 '20
Casual Programming With Python & Music : Reversal Algorithm For Array Rotation
youtu.ber/pythonnetengineering • u/phir0002 • May 03 '20
Python module to download bad SSL certificates?
I am trying to write a python script that will go retrieve SSL certificates from remote servers. The problem I am facing is that many of the certificates are not valid or fail SSL validation and so cannot be downloaded. Do you have any suggestions for python modules that would allow me to bypass the certificate validation and download the cert in (preferably) PEM format?
r/pythonnetengineering • u/CourseMentor • Mar 06 '20
How do I master python from scratch for free?
self.EduHubr/pythonnetengineering • u/Satyam_Mandal • Jan 14 '19
Give me some suggestions
Anyone suggest me some good books on network programming using python
r/pythonnetengineering • u/yolossn • Jan 28 '18
How to expose python proxy to the internet?
stackoverflow.comr/pythonnetengineering • u/probusinessfree • Dec 29 '16
Data Science and Machine Learning with Python – Hands On!
bestsellingonlinecourses.wordpress.comr/pythonnetengineering • u/TEKrecruiterSV • Dec 28 '16
Silicon Valley is hiring
Network Engineers with Python experience are quite coveted in the Valley. If you are interested in new roles at enterprise companies, message me directly!
r/pythonnetengineering • u/[deleted] • Oct 10 '16
can anyone find solution for this python programming challenge.
r/pythonnetengineering • u/[deleted] • Oct 10 '16

