Coder Social home page Coder Social logo

Comments (8)

bbayles avatar bbayles commented on August 22, 2024

@malli02422, change your cap=pyshark.FileCapture('D:\mallik.cap') line to cap=pyshark.FileCapture(r'D:\mallik.cap')?

from pyshark.

bbayles avatar bbayles commented on August 22, 2024

Discussion continued in #60; closing this.

from pyshark.

malli02422 avatar malli02422 commented on August 22, 2024

Hi
still I am Getting the same thing .
import pyshark

cap=pyshark.FileCapture(r'D:\mallik.cap')
print cap[0]

C:\Python27\python.exe "D:/Trailproject/string conversion.py"
Traceback (most recent call last):
File "D:/Trailproject/string conversion.py", line 5, in
print cap[0]
File "C:\Python27\lib\site-packages\pyshark\capture\file_capture.py", line 58, in getitem
self.next()
File "C:\Python27\lib\site-packages\pyshark\capture\file_capture.py", line 48, in next
packet = self._packet_generator.send(None)
File "C:\Python27\lib\site-packages\pyshark\capture\capture.py", line 159, in _packets_from_tshark_sync
tshark_process = existing_process or self.eventloop.run_until_complete(self._get_tshark_process())
File "C:\Python27\lib\site-packages\trollius\base_events.py", line 300, in run_until_complete
return future.result()
File "C:\Python27\lib\site-packages\trollius\futures.py", line 287, in result
raise self._exception
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect

Process finished with exit code 1

from pyshark.

goretkin avatar goretkin commented on August 22, 2024

Can you run the command

f = open(r'D:\mallik.cap')

?

from pyshark.

malli02422 avatar malli02422 commented on August 22, 2024

I have run the command and found the following out put.

f=open(r'D:\mallik.cap')
print f

C:\Python27\python.exe "D:/Trailproject/string conversion.py"
<open file 'D:\mallik.cap', mode 'r' at 0x01CCA230>

Process finished with exit code 0

On Fri, Feb 20, 2015 at 11:00 PM, Gustavo Goretkin <[email protected]

wrote:

Can you run the command

f = open(r'D:\mallik.cap')

?


Reply to this email directly or view it on GitHub
#52 (comment).

Best Regard
Mallikarjuna Reddy Thathekalva

from pyshark.

malli02422 avatar malli02422 commented on August 22, 2024

I have tried this
r=file(r'D:\mallik.pcap')
while True:
line=r.readline()
if (len(line)==0):
break
line=line.rstrip('\n')
print line
r.close()

And I got following output

C:\Python27\python.exe D:/Trailproject/packetCapture.py

� M<+

Process finished with exit code 0

I am not able to use it with windows and I have verified the following code as well
import pyshark
capture=pyshark.FileCapture('D:\mallik.pcap')
print capture.len()

C:\Python27\python.exe D:/Trailproject/packetCapture.py
0

Process finished with exit code 0

The array length is Zero
will only work with Linux ?? is there is any way to use it with windows??

from pyshark.

bbayles avatar bbayles commented on August 22, 2024

Using \ characters in paths is going to cause a problem - use r'D:\mallik.pcap' or 'D:/mallik.pcap'. See here.

I think that a more appropriate venue for these questions is Stack Overflow. If you make a post there and send me the link I will help you there.

from pyshark.

malli02422 avatar malli02422 commented on August 22, 2024

Hi ,
Unfortunately This doesn't work out .
Please find the code that I have edited

import pyshark
capture=pyshark.FileCapture(r"D:\mallik.pcap")
print capture.len()

C:\Python27\python.exe D:/Trailproject/packetCapture.py
0

Process finished with exit code 0

Find the attached pcap file . I can't able o execute the very basic command
as well. I don't how I can use this library

On Mon, Mar 9, 2015 at 7:52 PM, Bo Bayles [email protected] wrote:

Using \ characters in paths is going to cause a problem - use
r'D:\mallik.pcap' or 'D:/mallik.pcap'. See here
https://pythonconquerstheuniverse.wordpress.com/2008/06/04/gotcha-%E2%80%94-backslashes-in-windows-filenames/
.

I think that a more appropriate venue for these questions is Stack
Overflow. If you make a post there and send me the link I will help you
there.


Reply to this email directly or view it on GitHub
#52 (comment).

Best Regard
Mallikarjuna Reddy Thathekalva

from pyshark.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.